|
Re: Are UnitOfWork#hasChanges side effects a bug? [message #559150 is a reply to message #559066] |
Wed, 15 September 2010 19:00 |
Chris Delahunt Messages: 1389 Registered: July 2009 |
Senior Member |
|
|
Please file a bug to have this behavior changed, and vote for it. This is occuring because the relationship is traversed when hasChanges is called, forcing the Reminder object to be registered so that it can be included in the calculated changes. Unfortunately, it is unable to unregister objects found this way. And because it is not incremental like flush (changes are just thrown away) it has no way of keeping track that a Reminder was added through the privately owned 1:M relationship - when commit eventually occurs, EclipseLink will not see any changes in the collection from when the object was registered, so it can't determine that the Reminder object should be unregistered/deleted.
After you call hasChanges, you will need to treat all transitional (not yet persistent) relationships as if the objects referenced were registered independently. In this case, it means calling unregister or remove on the Reminder instead of just dereferencing it. Or, you can using the JPA flush mechanism which better allows getting incremental changesets.
Best Regards,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.03149 seconds