|
Re: ObjectChangeSet always null [message #556072 is a reply to message #555708] |
Mon, 30 August 2010 17:34 |
|
What is objectToBeUpdated, is it the object you want to merge, or the object in the persistence context? You must use the object from the persistence context (i.e. em.find(objectToBeUpdated.getClass(), objectToBeUpdated.getId()))
getObjectChangeSetForClone() will return the current changes for the object in the persistence conext, if you have not merge yet, then there will not be any changes.
James : Wiki : Book : Blog : Twitter
|
|
|
|
Re: ObjectChangeSet always null [message #556723 is a reply to message #555708] |
Thu, 02 September 2010 13:02 |
|
getCurrentChanges() will return all changes made in the persistence unit.
getObjectChangeSetForClone() will only return the local object's change (if any), it will include any changes to any mapped attribute (basic, 1-1, 1-m, embedded, etc.). If the relationship did not change (i.e. added/removed, different object) then there will be no change for the relationship, even if the target of the relationship changed. The targets changes will be in their own change set.
So you will need to look up the change sets for the related objects to see if they changed.
James : Wiki : Book : Blog : Twitter
|
|
|
Powered by
FUDForum. Page generated in 0.03381 seconds