Container transaction assembly settings

Container transaction settings specify how an EJB container is to manage transaction scopes for the enterprise bean's method invocations. Specify one or more methods and associate a transaction attribute with each method.

 

Name

Specifies a name for the mapping between a transaction attribute and one or more methods.

 

Description

Contains text that describes the mapping.

 

Transaction attribute

Specifies how the container must manage the transaction boundaries when delegating a method invocation to an enterprise bean's business method.

Data type String
Default Required
Range For all but message-driven beans, valid values are Mandatory , Never , Not Supported , Required , Requires New , Supports . For session beans, Bean Managed is also valid. For message-driven beans, only Bean Managed , Not Supported , and Required are valid.

Additional information about valid values follows:

 

Bean Managed

Notifies the container that the bean class directly handles transaction demarcation. This setting can be specified for session beans and (in EJB 2.0 implementations only) for message-driven beans, and it cannot be specified for individual bean methods.

 

Mandatory

Directs the container to always call the bean method within the transaction context associated with the client. If the client attempts to invoke the bean method without a transaction context, the container throws the javax.jts.TransactionRequiredException exception to the client. The transaction context is passed to any EJB object or resource accessed by an enterprise bean method.

EJB clients that access these entity beans must do so within an existing transaction. For other enterprise beans, the enterprise bean or bean method must implement the Bean Managed value or use the Required or Requires New value. For non-enterprise bean EJB clients, the client must access a transaction by using the javax.transaction.UserTransaction interface.

 

Never

Directs the container to invoke bean methods without a transaction context.

  • If the client calls a bean method from within a transaction context, the container throws the java.rmi.RemoteException exception.

  • If the client calls a bean method from outside a transaction context, the container behaves in the same way as if the Not Supported transaction attribute was set. The client must call the method without a transaction context.

 

Not Supported

Directs the container to call the bean method without a transaction context. If a client calls a bean method from within a transaction context, the container suspends the association between the transaction and the current thread before invoking the method on the enterprise bean instance. The container then resumes the suspended association when the method invocation returns. The suspended transaction context is not passed to any enterprise bean objects or resources that are used by this bean method.

 

Required

Directs the container to call the bean method within a transaction context. If a client calls a bean method from within a transaction context, the container calls the bean method within the client transaction context. If a client calls a bean method outside a transaction context, the container creates a new transaction context and calls the bean method from within that context. The transaction context is passed to any enterprise bean objects or resources that are used by this bean method.

 

Requires New

Directs the container to always call the bean method within a new transaction context, regardless of whether the client calls the method within or outside a transaction context. The transaction context is passed to any enterprise bean objects or resources that are used by this bean method.

 

Supports

Directs the container to call the bean method within a transaction context if the client calls the bean method within a transaction. If the client calls the bean method without a transaction context, the container calls the bean method without a transaction context. The transaction context is passed to any enterprise bean objects or resources that are used by this bean method.

 

Methods - Name

Specifies the name of an enterprise bean method, or the asterisk character (*). The asterisk is used to denote all methods of an enterprise bean's remote and home interfaces.

 

Methods - Enterprise bean

Specifies which enterprise bean contains the methods indicated in the Name setting.

 

Methods - Type

Used to distinguish between a method with the same signature that is defined in both the home and remote interface. Use Unspecified if a transaction attribute applies to all methods of the bean.

Data type String
Range Valid values for EJB 1.1 implementations are Home , Remote , or Unspecified . For EJB 2.0 implementations, Local and LocalHome are also valid.

 

Methods - Parameters

Contains a list of fully qualified Java type names of the method parameters. This setting is used to identify a single method among multiple methods with an overloaded method name.


Assembling EJB modules
Managing EJB containers
Tuning performance
Application assembly performance checklist

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.