-->
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.  [ 7 posts ] 
Author Message
 Post subject: Transaction release possibility
PostPosted: Tue Apr 06, 2004 5:44 am 
Regular
Regular

Joined: Thu Feb 05, 2004 6:51 am
Posts: 50
Hi all,

After havong created a transaction, we can perform commit or rollback, but is there a way to release it, I mean a method to close the transaction without having to commit ?

Vladislav


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 5:47 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A transaction can by definition only end with a commit or rollback. You probably need a rollback.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 5:54 am 
Regular
Regular

Joined: Thu Feb 05, 2004 6:51 am
Posts: 50
You mean need a release?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 5:55 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
There is no "release" operation, it's called "rollback".

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 5:58 am 
Regular
Regular

Joined: Thu Feb 05, 2004 6:51 am
Posts: 50
But anyway, if I just do not rollback or commit the transaction, nothing about database operation will happen, is this right?

And if I close the session (type Session), it will close all transaction attached to it? will it rollbacked them or just leave them in the state they were before without performing the change on db? And if I do that (closing the session), it will be necessary to rebuilt it after (redo all the mapping) ??

Vlad


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 5:59 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Man, just execute a rollback. If you close the transaction/connection/session, a rollback will be executed anyway. You don't have to commit before calling rollback.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 6:00 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A rollback will only roll back the database state, not the object state. Discard the Session after rollback and start over.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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