-->
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: Does tx.rollback undo a session save?
PostPosted: Wed Jul 14, 2004 6:36 am 
Beginner
Beginner

Joined: Sun Jun 20, 2004 11:39 pm
Posts: 24
Hi there,
I would like to know if i have a


Session s = factory.openSession();
Transaction tx = s.beginTransaction();

.......
tx.commit();
s.close();

block like this, and in the middle of it i create a new object and session.save() it but however, further down the line but before the tx.commit(), an error occurs and tx.rollback is called, would the saving of the new object be rolled back too? cos from what i remember from experience, the object seem to stay persistent in the database even after i have rolled back the code. Could some one please shed some light on this?



Best Regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 6:43 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
1- beginTransaction
2- do some work
3- error occurs
4- rollback is called

--> no change is persisted but you have to close and discard the session
of course if a commi is called between step 1 and 3, changes will be persisted

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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.