-->
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: error handling - rolling back changes in pojos
PostPosted: Tue Oct 11, 2005 4:54 pm 
Newbie

Joined: Tue Oct 11, 2005 4:38 pm
Posts: 7
Hibernate version:2

I have a pojo with a Set in it (an association). When I add an entry X to the Set and the transaction commit()s, everything is fine.

But when an exception occurs (application exception, not db-exception) and the transaction is rollback()ed, my pojo stil has the new entry in it (as expected). When the pojo is updated later, this new object is not saved to the db.

What is the best way to re-initialize (rollback) the Set, so that I can add X again and retry the transaction?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 5:15 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
There is no rollback for the object graph and it is very important to close the session after an exception. if you are doing this, you should have no problems on the second save . you are on your own if you do not throw the tainted Session away.


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.