-->
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: problem with doing query in PreEventInsertListener
PostPosted: Tue Feb 09, 2010 9:17 am 
Newbie

Joined: Fri Feb 17, 2006 5:45 pm
Posts: 6
Hello,

I have a implementation code for hibernate's PreInsertEventListener, where I need to do a hql query to check some data - based on that query, I need to update the object which originally caused this PreInsertEventListener. Problem is that when query() is called in this code which implements PreInsertEventListener, hibernate tries to flush the session, which in turn tries to do the Insert again, which in turn triggers this code for PreInsertEventListener, which is calling my query() again - it just recurses and ends after somepoint giving BatchUpdateException().

Question is how do I prevent this recursive behavior? How can I do a query within this code so that it won't flush to trigger another Insert event? Is there a way to do this query in a different session?

Thanks.


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.