This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB3 is it possible to mix BMT and CMT? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "EJB3 is it possible to mix BMT and CMT?" Watch "EJB3 is it possible to mix BMT and CMT?" New topic
Author

EJB3 is it possible to mix BMT and CMT?

Debopam Poddar
Ranch Hand

Joined: Jun 21, 2005
Posts: 49

Hi,

Is it possible to mix BMT and CMT as in the next example. TestAddCommand method is under BMT and calls methods of AddCommand and RemoveCommand which is under CMT. Is this possible?


H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 299
1. Is workable advisable?? (and why not?)

2. For experiment sake,

2.1 For RemoveCommand, instead of return null;
just throw new Exception();

2.2 Run TestAddCommand to see if you have a total rollback and especially for AddCommand in this experiment.
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Yes, it is possible to mix BMT and CMT. Moreover - the JTA started by the BMT can be reused by CMT, but not the other way around.
So if you have:

Client -> BMT -> CMT(REQUIRED), the CMT will reuse the transaction started by the BMT.
Client -> CMT -> BMT, the BMT will not be able to reuse the transaction started by the BMT.

HTH.

Cheers!

PS. This might be useful for you: http://stackoverflow.com/questions/7196242/why-does-cmt-commit-on-exit-of-ejb-method-when-transaction-attribute-is-required/7218283


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: EJB3 is it possible to mix BMT and CMT?
 
Similar Threads
EclipseLink1.1 inserts no data..
How to retrieve the string from textbox using Midlet to invoke the JSP
How to invoke the MIDlet ?
Strange behaviour of MDB and EJB
NullPointerException returned usig a StoredProcedureCall