-->
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.  [ 2 posts ] 
Author Message
 Post subject: Bug with PostUpdateEventListener:wrong Transaction ob return
PostPosted: Sun Aug 15, 2010 1:14 pm 
Newbie

Joined: Sat Oct 17, 2009 1:48 pm
Posts: 9
Hi guys, thank you for your help in advance.

I've discovered something that I hope is due to my own ignorance somehow and not due to a bug in Hibernate (which is a great product, btw). Anycase, Im having a system where Im retaining the DAO objects as business objects for a while and I need a system to rollback changes to the DAOs if a persist exception occurs, like a SQLException or such. To do this I'm utilizing a callback on PostUpdateEventListener. Im working uder assumption that if the Transaction was rolled back that there was some sort of an error.

However, after thorough debugging, I noticed that the object Transaction extracted from SessionImpl gotten from PostUpdateEvent obj is a different Transaction obj then the one I see on the session before tran.rollback() is called. I can tell because all the fields in this Transaction are set to false (commited, rolledback, begun, etc) as well as Eclipse's id for this object is different. HOWEVER, I CAN VERIFY THAT SESSION OBJECT IS STILL THE SAME, with Ecliplse's id and all the fields' values. I was getting the session via PostUpdateEvent.getSession() and Transaction via PostUpdateEvent.getSession().getTransaction(). When the processing returned to after the original tran.rollback() call, the old proper Transaction obj is returned from session.getTransaction(), complete with all the fields set to proper values (begun=true, rolledBack=true, etc).

Is this a bug in the handling of transactions or am I missing something? Thank you all for your responses in advance again.

I suspect similar might be in play with PostInsertEventListener and PostDeleteEventListener but havent verified yet.


Top
 Profile  
 
 Post subject: Re: Bug with PostUpdateEventListener:wrong Transaction ob return
PostPosted: Sun Aug 22, 2010 11:50 pm 
Newbie

Joined: Sat Oct 17, 2009 1:48 pm
Posts: 9
Has anybody else encountered this issue? Please help me if you know where to look for a solution


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.