• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transaction Attributes in ejb-jar.xml  RSS feed

 
PNS Subramanian
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Awaiting a reply
 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • 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
  • 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 ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!