Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (

Part Number E13981-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
View PDF

Configuring an EJB 2.1 Transaction Attribute

For an enterprise bean that uses container-managed transactions, you can configure how the container manages transactions when a client invokes a bean method (see "Using Deployment XML").

For more information, see the following:

Using Deployment XML

To configure how the container manages transactions when a client invokes a bean method, use the ejb-jar.xml file <assembly-descriptor> subelement <container-transaction>, as Example 21-4 shows.

Example 21-4 Configuring Transaction Attribute for an EJB 2.1 Session Bean


The <container-transaction> element contains one or more <method> elements and one <trans-attribute> element. The <trans-attribute> element applies to all the <method> elements. You can specify methods by name, by name and parameters (signature), or you can specify all methods of the specified enterprise bean using a wildcard <method-name>*</method-name>.

Table 21-2 lists the values for the <trans-attribute> element that you can specify and shows how the container will respond depending on whether or not a client-controlled transaction exists at the time the method is invoked

Table 21-2 Valid Values for the <trans-attribute> Element

Transaction Attribute ClientEControlled Transaction Exists ClientEControlled Transaction Does Not Exist

NotSupportedFoot 1 

Container suspends client transaction

Use no transaction

SupportsFoot 2 

Use client-controlled transaction

Use no transaction

RequiredFoot 3 

Use client-controlled transaction

Container starts a new transaction


Container suspends client transaction and creates a new transaction

Container starts a new transaction


Use client-controlled transaction

Exception raised


Exception raised

Use no transaction

Footnote 1 Default for EJB 2.1 message-driven beans.

Footnote 2 Default for EJB 2.1 session beans and BMP entity beans.

Footnote 3 Default for EJB 2.1 CMP entity beans.