I got one problem in my application, that is the transaction is not maintaining between two EJB's.
Example : Take two EJB's A and B. In A ejb i started one transaction and this ejb is calling another ejb B. In this B ejb, the new transaction is starting and commiting and then coming back to the A and remaining code is executing.
But the problem is, suppose if i get any exception in the end of the A ejb(that is B ejb execution completed) then in the Database operations in the ejb B are not rolledback. only the database operations in A are rollback.
So how can i maintain the trasaction between the two EJB's (A and B). Is it possible to maintain the transaction between two EJB's ??? Please give me solution for this
Thanks and Regards, Ravikumar
Joined: Apr 18, 2008
I guess the transaction attribute of method in EJB B is "requiredNew". Change the txn attribute to "require"
Joined: Jun 09, 2008
I am using BeanManagedTransactions. Is it possible to maintain the transaction state between ejb's?
please respond me as soon as possible
Thanks in advance krisha
Amit M Tank
Joined: Mar 28, 2004
If you use the "Required" transaction attribute then the same transaction context will propogate from EJB A to EJB B. I am not sure about BMT, but I guess you have to get the user transaction in EJB A and do an explicit rollback in case of an Exception.