This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes transactions - mixing BMT with CMT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "transactions - mixing BMT with CMT" Watch "transactions - mixing BMT with CMT" New topic

transactions - mixing BMT with CMT

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 808


What happens when I mix BMT with CMT? Let's say:

m1() -> m2()

* method m1 has BMT and calles userTransaction.begin() before calling m2()
* method m2 has CMT - REQUIRED.

Is the transaction propagated?

Mahendr Shinde
Ranch Hand

Joined: Sep 03, 2011
Posts: 38

If m2() is being invoked from m1() which has Transaction running, there are chances that your code will work. But why are you mixing CMT and BMT, you can use CMT for all your business methods. That way you don't have to lookup for Transaction in JNDI and hard code everything!
I assume both this methods belongs to different EJB's.

There is still lot to learn!
Have you checked out Aspose?
subject: transactions - mixing BMT with CMT
jQuery in Action, 3rd edition