Previously in this chapter, we briefly touched on reference data as part of CTS. Reference data consists of objects that are not the object we partition on. In the case where we use line item as the tree root, we have account and customer as reference data. This reference data doesn't typically change often. It's there to give the root entity context.
If we have orders of magnitude more line items than accounts and customers, then we would create a line item, and set its account to the right parent account. We would then use the entity manager to insert the new line item into the grid. The insert operation places the line item in the correct partition. With a Loader configured, the line item is saved to the database:
for (int i = 0; i < 1000; i++) { reference dataaboutLineItem item = new LineItem(); item.setId(i); Account account = (Account)accounts.get( (int)(Math.random() * 100)); item.setAccountId(account.getId()); item.setAmount(250 + i); try...