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.