-->
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: tx.rollback doesn't seems to work
PostPosted: Wed Aug 10, 2005 6:05 am 
Newbie

Joined: Thu Jul 14, 2005 7:54 pm
Posts: 11
Hibernate version:3.0
Database: Oracle 9i

I have 2 session.save(...) calls in 1 transaction, to save 2 objects to database
the first one succeeded and the second one failed and caused an exception, in the exception handler I called tx.rollback. but from the same connection/session, next time I fetch the object, the value has been updated which supposed to be rolled back.
Any ideas?


Top
 Profile  
 
 Post subject: Re: tx.rollback doesn't seems to work
PostPosted: Wed Aug 10, 2005 9:10 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
xguo wrote:
Hibernate version:3.0
Database: Oracle 9i

I have 2 session.save(...) calls in 1 transaction, to save 2 objects to database
the first one succeeded and the second one failed and caused an exception, in the exception handler I called tx.rollback. but from the same connection/session, next time I fetch the object, the value has been updated which supposed to be rolled back.
Any ideas?


make sure that during configuration you are setting the property hibernate.connection.autocommit = false.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 7:05 am 
Beginner
Beginner

Joined: Wed Jan 21, 2004 10:15 am
Posts: 24
Location: Munich, Germany
It is not a good idea to reuse a session when an exception has occurred.
What happened here is that the first object was still in the session cache.

Christian


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.