Java Reference
In-Depth Information
The @TransactionAttribute annotation allows us to control how an EJB's methods
will behave both when invoked while a transaction is in progress, and when invoked
when no transaction is in progress. This annotation has a single value attribute
that we can use to indicate how the bean's method will behave in both of
these circumstances.
The following table summarizes the different values that we can assign to the @
TransactionAtttibute annotation.
@TransactionAttribute value Method Invoked
while a Transaction
is in Progress
Method Invoked while no
Transaction is in Progress
TransactionAttributeType.
MANDATORY
Method becomes
part of the existing
transaction.
TransactionRequiredException
is thrown.
TransactionAttributeType.
NEVER
RemoteException
is thrown.
Method is executed without any
transaction support.
TransactionAttributeType.
NOT_SUPPORTED
Client transaction
is temporarily
suspended, the
method is executed
without transaction
support, then the
client transaction
is resumed.
Method is executed without any
transaction support.
TransactionAttributeType.
REQUIRED
Method becomes
part of the existing
transaction.
A new transaction is created for
the method.
TransactionAttributeType.
REQUIRES_NEW
Client transaction
is temporarily
suspended, a
new transaction
is created for the
method, then the
client transaction is
resumed.
A new transaction is created for
the method.
TransactionAttributeType.
SUPPORTS
Method becomes
part of the existing
transaction.
Method is executed without any
transaction support.
 
Search WWH ::




Custom Search