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-descriptor | The section in which all transaction-configuration has to occur |
| container-transaction | Assigns a transactional attribute to one or more methods |
| ejb-name | |
| method | Specifies the methods that take on the transaction attribute defined for this container-transaction |
| trans-attribute | Defines 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:
| Attribute | Meaning
|
| NotSupported | Must execute without a transactional context.
|
| Supports | If called from withing a transactional context,
will join that context.
|
| RequiresNew | Always creates a new transactional context.
|
| Required | Will use the current context if one exists, or create a new one if none exists.
|
| Mandatory | Must be called with an existing transaction context or will throw javax.transaction.TransactionRequiredException.
|
| Never | Suspends any existing transaction context.
|
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | ![]() |
|