Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
2.1.6:
Hi friends:
I want to call a method(execute some database operation,
need Hibernate Session!) when an Object have been update. So I implement the Lifecycle Interface and implement its onUpdate method.But as Hibernate2 doc says:
Code:
Note that onUpdate() is not called every time the object's persistent state is updated. It is called only when a transient object is passed to Session.update().
So it couldn't be used in this situation. Later , I use
interceptor interface and implement its onFlushDirty method, But I found that
the method don't have a Session Object! I couldn't use the Session Object in the Hibernate Interceptor!? Why interceptor interface don't give me a Session parameter?
I know Hibernate 3 have Event listener ,but Because the old system is large and it use hibernate2,So
it is impossible to change Hibernate2 to Hibernate3.
If I want to do something after some Object have been updated(for example: Session.update(User);) , How to do it?
Any idea will thks!