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 Java 8 in Action this week in the Java 8 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
Author

transactions - mixing BMT with CMT

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Howdy!

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?


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
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: http://aspose.com/file-tools
 
subject: transactions - mixing BMT with CMT
 
Similar Threads
Exception
Forcing a transaction to rollback
Some doubts with transactions(Please help).
setRollBack() Query
CMT vs. BMT