-->
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: Finding the status of a Transaction
PostPosted: Thu Nov 06, 2003 2:04 am 
Newbie

Joined: Wed Sep 03, 2003 8:36 pm
Posts: 5
Location: Melbourne, Australia
Hi,
I was just looking at the javadocs for net.sf.hibernate.Transaction and I was confused by the the documentation for Transaction.wasCommitted().

From: http://www.hibernate.org/hib_docs/api/n ... Committed()

Quote:
Was this transaction successfully committed? This method could return false even after successful invocation of commit().


I was wondering if this indicates some kind of unreliability in the wasCommited() method. The other thought I had is that this could be refering to the case where you have transactions nested, e.g:

Code:
Transaction t1 = session.beginTransaction();

// do stuff

Transaction t2 = session.beginTransaction();

// do more stuff (including something that causes an error)

t2.commit();

t1.commit();


In the above case the call to t2.commit() would appear successful, but t1.commit() is where the Exception would be thrown to indicate an error that is actually an error. However, if you check t2.wasCommitted() it would return false, as it is the cause of the error in t1.commit(). This is fine for my purposes, but is it what the documentation quoted above was refering to?

I was going to begin introducing Transaction.wasCommitted() for some new features in a production system, but am unsure whether it can be relied upon... it seems to do the job fine in prototypes, but the documentation shown above worries me. Any advice?

Thanks,
Luke.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 06, 2003 7:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
In a scenario where Hibernate is participating in a JTA transaction with broader scope, the outcome of the transaction might still be in doubt even after calling commit().


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.