TopLink Wiki
Main
RecentChanges
Set your name in
UserPreferences
Referenced by
JSPWiki v2.0.52
|
TopLink will evaluate classes for insert/update/deletes based on the order in which descriptors are added to the project. In the workbench, they are added alphabetically by default, but this can be changed.
TopLink also calculates dependencies at the object level to ensure constraints are not violated. Since there could be constraints that are not mapped in TopLink, such as a foreign key mapped direct to field instead of using a 1:1, TopLink descriptors have the addConstraintDependencies(class) api. This allows you to specify that a specific descriptor has an unmapped dependency on another class, and so it should be inserted/updated after that class. Adding addConstraintDependencies(b.Customer.class) to the a.Order descriptor in an ammendment method is one way of ensuring a specific insert order of unrelated classes. forum:304924
To guarantee a retrieval order (which is *never* tied to the insertion order, see below), you need an ordering key. TopLink can't really help; you need to add that ordering key yourself.
I wouldn't rely on sequence numbers for this, as TopLink does not insert objects in the order they are registered; at commit time TopLink computes the commit order for the objects based on referential integrity constraints. forum:299356
See also
|
||||||