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: Question on PostInsertEventListener
PostPosted: Tue Jan 12, 2010 5:49 am 
Newbie

Joined: Thu Mar 02, 2006 4:27 am
Posts: 3
I'm using Hibernate 3.3.2.GA and I have a question on PostInsertEventListener. I'm using it to produce a report that has a foreign key to the entity that is listening for the event.

Unfortunately this doesn't work as I'd expected because the entity has not been inserted yet and I get a integrity constraint violation. I only see the insert statement go through _after_ the PostInsertEventListener is notified.

Am I missing something? Shouldn't the entity have been inserted _before_ the listener is notified?

I then tried to use the postCommitInsert, but as the name implies, it's called after the commit, and I want to insert the report in the same transaction.

What are my options? What do I need to do to get a callback after the insert actually happens?

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.