It's not a secret anymore!
The moose likes EJB and other Java EE Technologies and the fly likes MDBs and transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "MDBs and transactions" Watch "MDBs and transactions" New topic

MDBs and transactions

Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
MDBs basically work asynchronously and are not part of transactions as well. But i was wondering is there a way they can behave synchronously and become part of a transaction?

The reason why i am asking is that i have to change the code of some old project, where lots of MDBs are called serially , These MDBs call Session Beans which in turn call CMPs. Now the calls to CMPs are not in single transaction, as they are called via MDB. Is there some way I can make all the calls to CMPs in one single transaction without removing MDBs and changing lots of code ?


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
Brian Tinnel
Ranch Hand

Joined: Aug 25, 2003
Posts: 69
There is no way to make the MDB synchronous, but there are third party transaction managers that might allow an MDB to join an existing transaction. I would think that the code to do that would be much harder than converting the MDBs to stateless session beans.
I agree. Here's the link:
subject: MDBs and transactions
jQuery in Action, 3rd edition