InfoCenter Home >
6: Administer applications >
6.6: Tools and resources quick reference >
6.6.5: Administering EJB modules (overview) >
6.6.5.0: EJB module properties >
6.6.5.0.7: Assembly properties for container transactions

6.6.5.0.7: Assembly properties for container transactions

Container transaction properties specify how the container must 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 describing 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. The legal values are Never, Mandatory, Requires New, Required, Supports, Not Supported, and Bean Managed. The default is Not Supported.

  • Mandatory. Directs the container to always invoke 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 invoke a transaction by using the javax.transaction.UserTransaction interface.

  • Supports. Directs the container to invoke the bean method within a transaction context if the client invokes the bean method within a transaction. If the client invokes the bean method without a transaction context, the container invokes 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.

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

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

    • If the client invokes 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.

  • Requires New. Directs the container to always invoke the bean method within a new transaction context, regardless of whether the client invokes 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.

  • Not Supported. Directs the container to invoke bean methods without a transaction context. If a client invokes 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 invoke the bean method within a transaction context. If a client invokes a bean method from within a transaction context, the container invokes the bean method within the client transaction context. If a client invokes a bean method outside a transaction context, the container creates a new transaction context and invokes 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.

  • Bean Managed. Notifies the container that the bean class directly handles transaction demarcation. This property can be specified only for session beans, and it cannot be specified for individual bean methods.

Method Elements - Name
Specifies the name of an enterprise bean method, or the asterisk character (*). The asterisk is used to denote all the methods of the specified interface--for example, all methods of the remote interface.

Method Elements - Enterprise bean
Specifies which enterprise bean contains the methods indicated in the Name property.

Method Elements - Type
Used to distinguish between a method with the same signature that is defined in both the home and remote interface. Valid values are All methods, Remote methods, or Home methods. Use All methods if a transaction attribute applies to all methods of the bean.

Method Elements - Parameters
Contains a list of fully qualified Java type names of the method parameters. This property is used to identify a single method among multiple methods with an overloaded method name.
Go to previous article: 6.6.5.0.6: Assembly properties for method permissions Go to next article: Assembly properties for EJB modules

 

 
Go to previous article: 6.6.5.0.6: Assembly properties for method permissions Go to next article: Assembly properties for EJB modules