keeping a history: who done it? [message #503456] |
Mon, 14 December 2009 04:48  |
Eclipse User |
|
|
|
Does Eclipselink's history also support a "modified by" field?
I'm slowing replacing my old history keeping system with Eclipselink's approach. My old system hooked into the PCE's of a bean and used these to alter a "modified at" property. This property is used to trigger a history keeping logic.
One of the drawbacks of my approach is that unnecessary changes are recorded. If a child is changed, it fires a PCE and a copy (correctly) ends up in the history. But if a child is added or removed, the parent's collection-of-childeren is changed, and this also results in a PCE, so a copy of the parent also is placed in the history, even though none of the parent's actually stored properties have changed.
By relying on Eclipselink I can stop setting the "modified at" property and the unnecessary history records should go away, except there also is a "modified by" property. It is always very handy to know who to talk to if some change does not make sense. This property also is bound to the PCE, like modified by, so it still marks the parent as changed (if a different user from the previous is making a change naturally).
Tom
|
|
|
|
|
Re: keeping a history: who done it? [message #504095 is a reply to message #503777] |
Thu, 17 December 2009 03:52  |
Eclipse User |
|
|
|
> To keep track of a user modified by field, it is easiest to add the
> field to your object and update it when the object changes (such as
> using the PreUpdate event).
I switched to Eclipselink events instead of JPA's last week, and preInsert() and preUpdateWithChanges() seem to work fine (preUpdate() is called on way too much entities).
|
|
|
Powered by
FUDForum. Page generated in 1.01751 seconds