-->
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.  [ 1 post ] 
Author Message
 Post subject: Transaction: rollback, commit
PostPosted: Wed Dec 29, 2004 4:00 am 
Newbie

Joined: Wed Dec 15, 2004 3:52 pm
Posts: 2
Sorry, im a relative newbie to hibernate. My service is behaving a little strange. Here are the sequence of events

1) Save an object (create session, session.beginTransaction, transaction.commit(), session.close)
2) Save a 2nd object, whichcauses an exception, because of a unique constraint I have on one of the table columns (create session, session.beginTransaction, EXCEPTION THROWN, transaction.rollback, session.close)
3) Save a 3rd object (create session, session.beginTransaction, transaction.commit, session.close)

The problem is at step (3). The transaction is not committing to the database after step 3. As a result
a) If there is a 4th event, that causes an exception, both step 3,4 get rolledback
b) The only time step 3 gets commited is when a 4th transaction commits

It seems like the same transaction is being reused for steps (3,4). Any suggestions?? I am using MySql4

- Vivek


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.