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.  [ 3 posts ] 
Author Message
 Post subject: Do something after saving
PostPosted: Tue Sep 07, 2010 9:17 am 
Newbie

Joined: Tue Sep 07, 2010 9:12 am
Posts: 3
Hello.

I need to do something with an object, each time after Hibernate saves it. Is there any way (annotation maybe) for Hibernate to call a function after the object is saved?

Thanks for help!


Top
 Profile  
 
 Post subject: Re: Do something after saving
PostPosted: Tue Sep 07, 2010 11:02 am 
Regular
Regular

Joined: Thu May 07, 2009 5:56 am
Posts: 94
Location: Toulouse, France
take a look at @PrePersit, @PostPersit (http://docs.jboss.org/hibernate/stable/ ... eners.html)

_________________
everything should be made as simple as possible, but not simpler (AE)


Top
 Profile  
 
 Post subject: Re: Do something after saving
PostPosted: Tue Sep 07, 2010 11:34 am 
Newbie

Joined: Tue Sep 07, 2010 9:12 am
Posts: 3
Thanks, it's looks like something I need. I tried implementing it, and annnotated methods are not called! Never, none of the callbacks work. Do I need to enable something in the hibernate config?

Edit: ok, you need to use entity manager instead of default sessionFactory :)


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

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.