First page Back Continue Last page Graphics

Forcing the Master to Post Before the Detail


Notes:

Forcing the Master to Post Before the Detail

To remedy the problem, you reorder the lines of code in the example to create the Supplier first, and then the Product. Although this addresses the immediate problem, it still leaves the chance that another application developer can create things in an incorrect order.

A better solution is to make the entity objects themselves handle the posting order. To do this, you need to override the postChanges() method in the entity that contains the foreign key attribute referencing the associated entity object and update the Product to conditionally force a related, new Supplier to post before the service request posts itself.