ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Adding Transactions to Servlets with JOTM
Subject:   Transaction is flawed
Date:   2003-07-31 15:32:01
From:   anonymous2
if (success) {
utx.commit();
} else {
utx.rollback();
}


What happens if the commit fails? The transaction is never rolled back.


I usually do the following.


boolean success = false;
try{
//stuff
utx.commit();
success = true;
}
finally{
if(!success)
utx.rollback();
}


1 to 1 of 1
  1. Transaction is flawed
    2003-08-07 01:42:12  jeff.mesnil [View]

1 to 1 of 1