This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes BMP transaction propagation v nested transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "BMP transaction propagation v nested transaction" Watch "BMP transaction propagation v nested transaction" New topic
Author

BMP transaction propagation v nested transaction

Peter Warde
Ranch Hand

Joined: Aug 18, 2004
Posts: 71
I'm a bit cloudy about some aspects of transaction propagation. EJB does not support nested transactions so that

public void go() {

UserTransaction ut = context.getUserTransaction();
ut.begin();
doStuff();
ut.begin;

...... etc

is an illegal nested transaction.


But what if you have 2 objects each has a method with a transaction demarcation and one object's method calls the objects other method. Is this an illegal nested transaction or an example of transaction propagation. As far as I understand a BMT bean can propagate into another transaction or can it?. Can anyone clear this up for me.

Thanks.
H. Samarasekera
Greenhorn

Joined: Aug 25, 2004
Posts: 3
>>> "But what if you have 2 objects each has a method with a transaction demarcation and one object's method calls the objects other method. Is this an illegal nested transaction or an example of transaction propagation."

No, this will not result in a nested transaction (Assuming both are BMT objects). When the first BMT object calls the second BMT object, the first transaction will get temporarily suspended. And the second object will operate in a new transaction of its own.

>>> "As far as I understand a BMT bean can propagate into another transaction or can it?. Can anyone clear this up for me."

Both CMT and BMT can propagate to another CMT object. But no transaction can propagate into a BMT object. If a BMT object gets called from within a transaction context, it will temporarily suspend the calling transaction and will start a new transaction.


H. Samarasekera<br />------------------<br />SCJP 1.2 / SCBCD 1.3
 
GeeCON Prague 2014
 
subject: BMP transaction propagation v nested transaction