TopLink Wiki
Main
RecentChanges
Set your name in
UserPreferences
Referenced by
JSPWiki v2.0.52
|
You cannot register a serialized object into the unit of work directly, you must make use of the mergeClone API. In general there are 4 different mergeClones provided on the unit of work. forum:182154
In general you should use deepMergeClone with caution, it will merge all related objects, and all their related objects. Most likely what is occuring is that your employee has a reference back to its organization which holds all of the employees, which sometimes may contain a change or not. It is better to use mergeClone or shallowMergeClone to ensure you know what exactly is going to be merged and to avoid large object graph traversals. (emphasis added) deepMergeClone() is a very useful feature of TopLink as it allows the application to not have to be concerned with what it changes on the client. The client can traverse any relationships of the objects that are serialized to it (provided the relationships were serialized) and make whatever changes to whatever objects it desires. It can then send the entire object graph back to the server which can does not have to be aware of what the client was doing and can just deepMergeClone everything back into a unit of work and commit the changes to the database. Unfortunately the main benefit of deepMergeClone can also be its biggest issue when something goes wrong. DeepMergeClone traverses "everything" related to an object and merges "everything", for complex objects this can occasionally lead to the merging of changes that were not intended or desired by the client. Examples can include:
There is another thread with a similar issue that also links to another thread that has a good description of each of the unit of work merge APIs. forum:218071
In general deepMergeClone() is a very useful feature, and if you are using it successfully definitely don't stop using it. But if you commonly experience problems, or performance issues, you may wish the consider one of the other merge APIs that give the application more control over what is and is not merged. forum:188069
See AlsoUnitOfWork, UnitOfWorkPrimer, DebugUnitOfWork, forum:273645
|
||||||