I'm trying to set a modified date on records before they're saved. I'm using the session interface currently, so I can't use @PrePersist.
I've therefore stuck the logic in a SaveOrUpdateListener.
This basically works pretty well, except if someone calls save() or update() on an unmodified bean, the listener changes the mod_date and results in an update statement that otherwise wouldn't take place.
Is there a better way to do this - a different event listener or some way to determine if the bean has actually been modified before setting a modified date?
Thanks!
|