TopLink Wiki
Main
RecentChanges
Set your name in
UserPreferences
Referenced by
JSPWiki v2.0.52
|
Can TopLink auto-update lastModified (timestamp) and lastModifiedBy (userID) fields on every object? (also known as Poor Man's audit trails).
Quick answer:Register an aboutToUpdate event listener like the following:
public void toplinkAboutToUpdateEventHandler(DescriptorEvent event)
{
event.updateAttributeWithObject("myTimestamp", new Date());
event.applyAttributeValuesIntoRow("myTimestamp");
etc.
I do not recomment you use the preUpdate or preWrite events for this purpose as they can be fired even though the object has no changes and does not require updating! For created and createdBy fields, register an aboutToInsert event. Note that I ran into problems with the TopLink903 aboutToInsert event; I had to use the preInsert event instead.
Long Answer:
|
||||||