dcsimg
About Transactions in JAVA
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   hari_prasad
Posted On:   Thursday, June 16, 2005 01:09 AM

I have a small Doubt in Java Transaction API, I am not sure that i can take up this issue with you, if possible please answer. I will keep by question brief. I will just take an example and explain what my doubt is: (Only some part of Code) .............. .............. javax.transaction.UserTransaction utx = null; try { utx.begin(); // here i perform some DataBase Transactions utx.commit(); // I have commited _________ _________ /* again i perform some Transaction invloving database within the same transaction thread*/ ________ _________ utx.commit(); /* now some error occurs in the second part and an exception is thr   More>>

			
I have a small Doubt in Java Transaction API,
I am not sure that i can take up this issue with you, if possible please answer. I will keep by question brief. I will just take an example and explain what my doubt is: (Only some part of Code)


..............
..............
javax.transaction.UserTransaction utx = null;
try
{
utx.begin();
// here i perform some DataBase Transactions
utx.commit(); // I have commited
_________
_________
/* again i perform some Transaction invloving database within the same transaction thread*/
________
_________
utx.commit();
/* now some error occurs in the second part and an exception is thrown*/
}
catch(Exception e)
{
try
{
if(utx!=null)
utx.rollBack();
}catch(Excetion e){.....}
}
__________________________________________________________

if i say utx.rollBack() in the catch block will the changes i performed in the database in the first part stay or it gets rolled back. Please Go through the Comments in the code.

Thanks
Hari
   <<Less
About | Sitemap | Contact