| Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.1.0) Part Number B28221-02 |
|
|
View PDF |
You can configure who is responsible for managing transactions that involve a given EJB 2.1 enterprise bean (see "Using Deployment XML").
Note:
EJB 2.1 entity beans must always use container-managed transaction demarcation. An EJB 2.1 entity bean must not be designated with bean-managed transaction demarcation.For more information, see the following:
To configure transaction management, use the ejb-jar.xml file <transaction-type> subelement, as Example 21-3 shows.
Valid values are Container or Bean. The default is Container.
Example 21-3 Configuring Transaction Management for an EJB 2.1 Session Bean
<enterprise-beans>
<session>
<display-name>A Credit-Service Bean</display-name>
<ejb-name>CreditService</ejb-name>
<home>creditService.ejb.CreditServiceHome</home>
<remote>creditService.ejb.CreditServiceRemote</remote>
<ejb-class>creditService.ejb.CreditServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
...
</session>
...
</enterprise-beans>
You can configure <transaction-type> for all of session, entity, and message-driven beans. However, for an EJB 2.1 entity bean, you can only configure <transaction-type> as Container.