hello all,
I have a question how to combine ejb transaction with database transaction
in BMP
try
{
UserTransaction utx = lookup(...)
utx.begin();
(line 1 ) EmployeeHome empHome = lookup(..);
(line 2 ) Employee emp = empHome.find("abc");
(line 3 ) emp.remove();
(line 4 ) emp = empHome.find("xyz");
(line 5 ) emp.remove();
utx.commit();
}
catch ( Exception ex )
{
ex.rollback();
}
Employee Bean .....
public void ejbremove()
{
Connection con = DriveManager.getConnection
("jdbc:weblogic:jts:dbPool","null);
CallableStatement cs = null;
try
{
cs = con.preparecall(sql);
cs.execute();
}
catch ( SQLException sqlex )
{
cs.close();
}
finally
{
con.close(); // by closing are you commiting ???
/*
??? do you close here or not
??? if you are closing what hapens to the user transaction failure
??? if you are not closing then what hapens if this function is called
in a loop
*/
}
}
My transaction should remove both employees, i am making connection to
database in ejbRemove function of employee and call some proc then close the
connection
Question 1)
since i close the connection transaction succeed or not the
connection is committed , how do you rollback if it is failed
question 2)
if i am not closing the connection and if transaction fails then it
transaction will automatically rollback the connection it has also, question
is then how will i close the connection
-Thanks
sethu
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".