my dog learned polymorphism
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Transaction context propogation 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 "Transaction context propogation" Watch "Transaction context propogation" New topic

Transaction context propogation

Rahul JG
Ranch Hand

Joined: Jun 05, 2002
Posts: 44
I have an Entity Bean with two methods A() & B() with the following transaction attributes

A() - Required
B() - Required

Processing is as follows:

Client -> some logic -> A() -> B()

client is not associated with any transaction context & method A() internally calls method B().

What would happen to the transaction context of B()? Would it get the same transaction context that was started in A(), or would it create a new one.

The specs say that the container interposes every method invocation on the home or component interface and applies the transaction parameters accordingly. In the above case the call from A() to B() is not a remote one, but a local one.

sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
Since the transaction attribute is set to 'Required' for method B() and A() is internally calling B() then method B() will run in the transaction context of method A().

[ May 12, 2005: Message edited by: sawan parihar ]

Sawan<br />SCJP,SCWCD,SCBCD<br /> <br />Every exit is an entry somewhere.
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
B will run in A's transaction context. I don't think it makes any difference whether the call is local or remote.

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
I agree. Here's the link:
subject: Transaction context propogation
It's not a secret anymore!