Hibernate version: 3.0.5
So it appears that it's just not possible to tell if an object has been changed when doing a save. I have a Web application that uses detached objects, and have written an interceptor for "onFlushDirty". My save method looks like this:
Code:
public PersistentObject save(PersistentObject persistentObject)
throws EosException {
Transaction tx = null;
try {
tx = session.beginTransaction();
session.saveOrUpdate(persistentObject);
session.flush();
tx.commit();
}
catch(...) { ...}
}
The problem is, when the onFlushDirty method is called, the "previousState" array is null. I have a lot of model objects in my application, and the number continues to grow - I certainly don't want to implement setDirty(true) in every set method. So, apart from AspectJ, does anyone have any ideas? Am I missing something?
Thanks,
Don