aspose file tools
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 The Software Craftsman this week in the Agile 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: 807


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 tried LearnNowOnline?
subject: transactions - mixing BMT with CMT