We are trying to insert multiple objects at a time using registerAllObjects(Collection) method. The objects should be inserted exactly in the order given in the collection. But after committing the transaction, the insertion order of objects are unpredictable.
How can we make sure that the objects are inserted exactly in the order added in the collection?
Thanks in advance for your help.
Edited by: 982117 on Jan 16, 2013 12:30 AM
TopLink inserts objects based on referential integrity rules, deadlock avoidance, and other rules.
What issue is the order causing you?
To force the order you can use flush() in JPA, or execute multiple UnitOfWork in the native API.
Hi James, Thank you for your reply.
Our business rules force to insert the objects in the insertion order. We are using native Toplink API.
I will consider using multiple UnitOfWork executions for insertion.