Hi,
I am using an Interceptor to trigger some events when a persistent object is saved, deleted, or updated.
The behaviour I am trying to implement is :
- call onSave() when a new object is saved.
- call onDelete() when an object is deleted.
- call onFlushDirty() when an object is updated.
I am using the OpenSessionInViewFilter from spring so the session is flushed automatically.
My problem is that when I delete an object, the onDelete() method is called (expected behaviour) but when the session is flushed onFlushDirty() is called for the deleted object again.
Is there a way to prevent onFlushDirty() to be called for deleted objects?
I also tried to make the difference between calls to onFlushDirty() for the updated objects and those for the deleted objects (using previousState and currentState but didn't succeed)
Any hint are very welcome, thanks
Thomas
Hibernate version: 3.0.5
|