| Author |
Transaction Propagation Question ??
|
Khaled Mahmoud
Ranch Hand
Joined: Jul 15, 2006
Posts: 360
|
|
Hi all, SWe have two Stateless ession beans S1 and S2. S1 uses container managed transaction demarcation. S2 uses bean managed transaction demarcation. S1 starts a transaction and calls method on S2. Will the transaction be propagated from S1 to S2 assuming that the method on S2 uses bean managed transaction demarcation ??? Thanks in advance.
|
SCJP, SCJD,SCWCD,SCDJWS,SCEA 5 MCP-C#, MCP-ASP.NET - http://www.khaledinho.com/
Life is the biggest school
|
 |
Celinio Fernandes
Ranch Hand
Joined: Jun 28, 2003
Posts: 546
|
|
I think this is a good question. As far as I know, it is fine for a container-managed method to call a bean-managed method on another bean. Will the transaction propagate ? That depends on the choosen transaction attribute for this bean-managed method: Required, RequiresNew, Manadatory, NotSupported, Supports, Never. Check the rules for each of these attributes.
|
SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCBCD 5
Visit my blog
|
 |
Narendra Dhande
Ranch Hand
Joined: Dec 04, 2004
Posts: 950
|
|
Hi, The transaction started in S1 will be temporarily suspended. The BMT in S2 is new transaction. The transaction attributes are applicable only for container-managed transactions and not for Bean managed transaction. The BMT always start new transaction. Thanks
|
Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
|
 |
Nitesh Kant
Bartender
Joined: Feb 25, 2007
Posts: 1638
|
|
Originally posted by Celinio Fernandes: Will the transaction propagate ? That depends on the choosen transaction attribute for this bean-managed method: Required, RequiresNew, Manadatory, NotSupported, Supports, Never. Check the rules for each of these attributes.
These attributes are present only for Container manager transaction demarcation. Bean managed demarcation starts a transaction using begin on UserTransaction object. Coming to the original question, In such a scenario, as ejbs does not support nested transactions, the transaction from bean S1 will be suspended before starting a new transaction in S2. When the transaction is S2 finishes, S1 will be resumed.
|
apigee, a better way to API!
|
 |
Celinio Fernandes
Ranch Hand
Joined: Jun 28, 2003
Posts: 546
|
|
Indeed, I got mixed up with the different scenarios and replied too quickly ! :roll: A different bean with bean-managed transaction demarcation means new transaction of course. [ December 27, 2007: Message edited by: Celinio Fernandes ]
|
 |
Kamlesh Devani
Ranch Hand
Joined: Mar 15, 2005
Posts: 37
|
|
Will the transaction propagate ? That depends on the choosen transaction attribute for this bean-managed method: Required, RequiresNew, Manadatory, NotSupported, Supports, Never. Check the rules for each of these attributes. These attributes are present only for Container manager transaction demarcation. Bean managed demarcation starts a transaction using begin on UserTransaction object. I have a doubt. suppose if a client with a transactional context Required calls a method on a session bean with bean managed transaction what would be the result? Thanks in advance.
|
 |
Nitesh Kant
Bartender
Joined: Feb 25, 2007
Posts: 1638
|
|
Originally posted by Kamlesh Devani: I have a doubt. suppose if a client with a transactional context Required calls a method on a session bean with bean managed transaction what would be the result? Thanks in advance.
No difference then what i have told in my earlier post. Suspension of the current transaction is because of the fact that ejb does not support nested transactions and that is true irrespective of the transactional requirements of the calling method.
|
 |
 |
|
|
subject: Transaction Propagation Question ??
|
|
|