File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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!
I agree. Here's the link:
subject: transactions - mixing BMT with CMT
It's not a secret anymore!