Hi,
I have a class that extends DefaultSaveOrUpdateEventListener, that overrides public void onSaveOrUpdate(SaveOrUpdateEvent event).
The method is supposed to be called whenever a Save or Update is about to happen and set the audit fields (created and updated timestamps) on the object to be saved.
For some reason, this method is getting called when the session/transaction commits on a hibernateTemplate.get(class, id).
It only occurs when doing a get() on a parent object with a collection of child objects (standard one-to-many)
So the question is:
Why is the DefaultSaveOrUpdateEventListener.onSaveOrUpdate(SaveOrUpdateEvent event) method being called when the session commits at the end of a hibernateTemplate.get(class, id) call?
And why does it only happen on objects in a collection?
Thanks.
|