wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes regarding transactions between ejbs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "regarding transactions between ejbs" Watch "regarding transactions between ejbs" New topic
Author

regarding transactions between ejbs

venkata kri
Greenhorn

Joined: Jun 09, 2008
Posts: 4
Hi Friends,

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


jvkrishna
Vichan Chutitaporn
Greenhorn

Joined: Apr 18, 2008
Posts: 3
I guess the transaction attribute of method in EJB B is "requiredNew". Change the txn attribute to "require"
venkata kri
Greenhorn

Joined: Jun 09, 2008
Posts: 4
Hi

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
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
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.


Amit Tank
Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding transactions between ejbs
 
Similar Threads
Transactions
transaction state between ejbs
Promlem with Transactions in EJB
some unsure questions on phase 1
Distributed transactions