Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Transaction Attributes in ejb-jar.xml

 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Suppose we set the <transaction-type> tag to Container in the ejb-jar.xml file and do not specify any <trans-attribute> tag what would be the default value of the transaction attribute that would be applied ?
2) When we use Bean Managed JTA, and get the UserTransaction from one component's session context, is this transaction context valid when we call a different (Bean Managed) component ? Since a JTA is managed by J2EE Server, would the called component use its own transaction context ?
 
PNS Subramanian
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Awaiting a reply
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1) Suppose we set the <transaction-type> tag to Container in the ejb-jar.xml file and do not specify any <trans-attribute> tag what would be the default value of the transaction attribute that would be applied ?


According to spec 17.5, The Deployer is responsible for ensuring that the methods of the deployed enterprise beans with container-managed transaction demarcation have been assigned a transaction attribute. If the transaction
attributes have not been assigned previously by the Assembler, they must be assigned by the Deployer.

So while deploying the beans, the deployer has to make sure that a valid tx attribute has been assigned to all methods defined in spec 17.4.1


2) When we use Bean Managed JTA, and get the UserTransaction from one component's session context, is this transaction context valid when we call a different (Bean Managed) component ? Since a JTA is managed by J2EE Server, would the called component use its own transaction context ?

This can depend on the type of transaction atrributes defined for the methods in the second component.
 
PNS Subramanian
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question was not about who should specify the transaction attribute - the question is what would happen if we specify Container managed transaction without specifying the transaction attribute ? How would the application behave in this case ?

For the second questin, both the components have BeanManaged transaction as the transaction attribute. Would the second component's transaction override(/be independent of) the calling components transaction ?
 
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic