I'm using 3.0.5
My entities have a modified timestamp on them. I've been setting it in an Interceptor in the methods onSave() and onFlushDirty(). Unfortunately, that fails me in one case... when a parent entity is updated, and only a collection has been modified, onFlushDirty() is never called.
I suppose what I want is for the entity passed to session.update() to have it's modified timestamp touched whenever the session.update() method will result in some SQL.
To cover the likely suggestions... I've tried implementing Lifecycle (which has the same problem). I've also tried using a <timestamp> property in my hbm.xml files. This actually solves my problem, but introduces another!
The problem it introduces for me is that hibernate will now version-check my changes for stale updates. I'd actually prefer a last-update-wins strategy, but I can't seem to figure out how to ask hibernate to maintain a version timestamp for me, but ignore the property when updating.
Has anyone tackled this?
Thanks in advance.
Phill
|