In this scenario the application doesn’t control the transaction and it doesn’t allocate neither UserTransaction nor LocalTransaction (if it does, an exception will be thrown by the EJB Container). However, it should make a corresponding declaration in the ejb-jar.xml, to enable the EJB Container to control the transaction:
………………………………
<enterprise-beans>
…………………………………
<session>
<display-name>ExampleBean</display-name>
<ejb-name>ExampleBean</ejb-name>
<home>com.sap.mw.jco.jra.examples.ExampleHome</home>
<remote>com.sap.mw.jco.jra.examples.Example</remote>
<ejb-class>com.sap.mw.jco.jra.examples.ExampleBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type> Container </transaction-type>
<resource-ref>
<res-ref-name>MyConnFactory</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>ExampleBean</ejb-name>
<method-name>
callBapiBankCreateUsingContainerTransaction
</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
…………………………………
For each method you can separately configure the type of transaction attribute that is valid for each method.
For details, see the EJB specification.