A simple test indicates that the behavior of Session.merge() is inconsistent when a model object implements the Lifecycle interface. The onLoad(), onSave() methods of Lifecycle are invoked at appropriate times during the Session.merge() method, but the onUpdate() method is never invoked.
On the other hand, the Session.saveOrUpdate() method invokes onLoad(), onSave() and onUpdate() correctly.
I need this function to update the LastUpdateTime column of several tables. Is there an alternative, other than creating triggers for each table?
I'm using Hibernate 3.1/3.0.5 at WebLogic 8.1 SP3.
|