preUpdateWithChanges [message #515972] |
Mon, 22 February 2010 05:54  |
Eclipse User |
|
|
|
I've got master-detail relationship mapped on both sides; the parent has a list of children, the child a single reference to the parent. When a new child is added, it is added to the parent's list, but in the "real" (database) world there naturally is only a foreign key from the child to the parent.
When persisting this, the preUpdateWithChanges event is fired on the parent. This confuses me, there is nothing to update on the parent.
And Eclipselink actually does not update anything if left alone, but I use this event to set a "who'd done it" field, which results in there being something to update, and I get an update just setting the who and version field. And as a consequence I get a lot of history records containing only a changed who'd-done-it field.
Why is the preUpdateWithChanges event fired when in fact there isn't anything to write to the database?
Tom
|
|
|
|
|
|
|
Re: preUpdateWithChanges [message #518047 is a reply to message #518038] |
Tue, 02 March 2010 15:40  |
Eclipse User |
|
|
|
> As long as you make the changes using the event object, they will be
> applied. (event.updateAttributeWithObject()).
Ok. I'm going to try this other approach I started today first; I know which properties are "changing" properties and which ones are not, so I should be able to set a boolean myself.
Tom
|
|
|
Powered by
FUDForum. Page generated in 8.92771 seconds