-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to use Session in Interceptor?(Hibernate2.1.6)
PostPosted: Tue Jan 03, 2006 10:11 pm 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
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!

_________________
You are not alone...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.