Hi Pooja,
I understood u problem, no need of doing anything like catching
SQLException.
What ever i gave in my last mail it works fine.
<%@ page import="javax.transaction.*" %>
UserTransaction u = (UserTransaction) ctx.lookup(
"javax.transaction.UserTransaction");
u.begin();
deposit=depositHome.create(accountId,balance);
System.out.println("Record Created in deposit");
accountId="5";
withdraw=withdrawHome.create(accountId,balance);
System.out.println("Record Created in withdraw");
u.commit();
in the above code i am inserting two records into a table from two beans,
if second bean fails to create, the entire transaction will be rolled back.
otherewise u can use executeBatch
And executebatch.
Statement smt = con.createStatement();
stmt.addBatch("INSERT INTO COFFEES" +
"VALUES('Amaretto', 49, 9.99, 0, 0)");
stmt.addBatch("INSERT INTO COFFEES" +
"VALUES('Hazelnut', 49, 9.99, 0, 0)");
stmt.addBatch("INSERT INTO COFFEES" +
"VALUES('Amaretto_decaf', 49, 10.99, 0, 0)");
stmt.addBatch("INSERT INTO COFFEES" +
"VALUES('Hazelnut_decaf', 49, 10.99, 0, 0)");
stmt.executeBatch(); I hope here also any one of insert stmt fails the
transaction will rolled back.
Edla B. Reddy
===========================================================================
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".
- Re: Container Managed Transactions in Entity Beans Shelly Aggrawal
- Re: Container Managed Transactions in Entity Beans Jay Walters
- Re: Container Managed Transactions in Entity Beans Pooja Keswani
- Re: Container Managed Transactions in Entity Beans Pooja Keswani
- Re: Container Managed Transactions in Entity Beans Shelly Aggrawal
- Re: Container Managed Transactions in Entity Beans Pooja Keswani
- Re: Container Managed Transactions in Entity Beans Jouni Peltonen
- Re: Container Managed Transactions in Entity Beans E Bakka Reddy
- Re: Container Managed Transactions in Entity Beans Jay Walters
- Re: Container Managed Transactions in Entity Beans Pooja Keswani
- Re: Container Managed Transactions in Entity Beans E Bakka Reddy
- Re: Container Managed Transactions in Entity Beans Pooja Keswani
- Re: Container Managed Transactions in Entity Beans G Ramasubramani
- Re: Container Managed Transactions in Entity Beans G Ramasubramani
- Re: Container Managed Transactions in Entity Beans Pooja Keswani
- Re: Container Managed Transactions in Entity Beans G Ramasubramani
- Re: Container Managed Transactions in Entity Beans E Bakka Reddy
- Re: Container Managed Transactions in Entity Beans Pooja Keswani
- Re: Container Managed Transactions in Entity Beans Jay Walters
- Re: Container Managed Transactions in Entity Beans Jay Walters
- Re: Container Managed Transactions in Entity Beans Pooja Keswani
