We have a SaveOrUpdateListener where we are trying to stamp audit trail data to our objects -- who was the last updater and when did they last update?
The only problem is that the stamps are occuring on objects associated with our main record object which are not dirty, but the stamp makes them dirty, and then another sql statement is brought into play. This has caused a whole lot of sql to be generated -- so much so that sometimes we deadlock DB2 with a simple update of our main record.
What is the best strategy for this kind of audit trail behavior which causes the least sql overhead in general?
Also, it would help us a lot, even it is not part of the best strategy, to know how to tell if an object is dirty as well. Are interceptors deprecated or are they still what we should be using for that? Is there a better way to tell if an individual object is dirty?
Thanks!,
Jim
|