• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Transaction Propagation Question ??

 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Celinio Fernandes
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic