-->
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: how to roll back ?
PostPosted: Mon Oct 01, 2007 3:13 am 
Beginner
Beginner

Joined: Mon Jul 30, 2007 4:58 pm
Posts: 21
What happens if I rollback a transaction after I flush ? Does it roll back ?

My Problem is that I have a batch update process through my web app. And during that process I have to do session.flush() and session.clear() frequently. However the server sometimes crashes.

And I want to ensure that if server crashes the entire batch process is rolled back. How can I do it ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 8:39 pm 
Regular
Regular

Joined: Sun Sep 30, 2007 7:51 pm
Posts: 93
Transaction life is something like:

begin()
flush()
flush()
...
commit or rollback

flush is a write from memory to database (in this case), but if database transaction is started (and mostly hibernate transaction ~ db transaction) it can be still rollbacked, or commited.

clear() will clean the session cache, be sure you call the flush before it or you will loose your changes.

For example, you can see the usage of frequent flush, clear here:
http://www.hibernate.org/hib_docs/v3/re ... batch.html

Regards,
Pavol


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.