| 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.
|
 |
 |
|
|
subject: EJB3 is it possible to mix BMT and CMT?
|
|
|