Basic Configuration
Resin 2.1

Reference Guide
EJB Reference Guide

EJBServer
JNDI
Entity Config
Relation Config
Session Config
Resin-EJB Config
SQL mapping
Transaction Config
Message Config
EJB-QL
xdoclet
Config Summary
Burlap
JMS
CORBA/IIOP
Index
SQL mapping
EJB Reference Guide
Message Config

The bean developer must specify how methods in deployed beans are to behave with regard to the container managed transaction contexts.

By default, Resin-CMP launches each method in a new transaction context if none exists (Require attribute).

assembly-descriptorThe section in which all transaction-configuration has to occur
container-transactionAssigns a transactional attribute to one or more methods
ejb-name
methodSpecifies the methods that take on the transaction attribute defined for this container-transaction
trans-attributeDefines which transaction context the specified method(s) takes on

Transaction Configuration

assembly-descriptor

The section in which all transaction-configuration has to occur.

container-transaction

Assigns a transactional attribute to one or more methods.

  <assembly-descriptor>
    <container-transaction>
      ...
    </container-transaction>
  </container-transaction>

ejb-name

Specifies the bean from which to chose the methods in this container-transaction

method

Specifies the methods that take on the transaction attribute defined for this container-transaction.

There are three ways of specifying methods:

  • Chose all methods from this ejb-name:

      <method>
        <ejb-name>student</ejb-name>
        <method-name>*</method-name>
      </method>  
    

  • Specify a transaction attribute for one particular method:

      <method>
        <ejb-name>student</ejb-name>
        <method-name>getName</method-name>
      </method>
    

  • If there are methods with the same name but different parameter lists that require different transaction contexts, they can be differentiated by specifying the parameter lists:

      <method>
        <ejb-name>student</ejb-name>
        <method-name>getName</method-name>
        <method-params>
          <method-param>java.lang.String</method-param>
          <method-param>int</method-param>
        </method-params>
      </method>
    

trans-attribute

Defines which transaction context the specified method(s) takes on.

The EJB 2.0 spec provides six options for transactional attributes:

AttributeMeaning
NotSupportedMust execute without a transactional context.
SupportsIf called from withing a transactional context, will join that context.
RequiresNewAlways creates a new transactional context.
RequiredWill use the current context if one exists, or create a new one if none exists.
MandatoryMust be called with an existing transaction context or will throw javax.transaction.TransactionRequiredException.
NeverSuspends any existing transaction context.


SQL mapping
EJB Reference Guide
Message Config
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.