The javax.ejb.TransactionAttribute annotation (@TransactionAttribute) can be applied to a bean class or it's methods.
Usage of the @TransactionAttribute requires you to specify on of six different transaction attribute types defined via the javax.ejb.TransactionAttributeType enum.
- TransactionAttributeType.MANDATORY
- TransactionAttributeType.REQUIRED
- TransactionAttributeType.REQUIRES_NEW
- TransactionAttributeType.SUPPORTS
- TransactionAttributeType.NOT_SUPPORTED
- TransactionAttributeType.NEVER
Attribute Types summary
To ensure your method is invoked in a transaction, one of tree attributes can be used; REQUIRED, REQUIRES_NEW, MANDATORY.
There's a much easier way to visualize the transaction attributes.
- Failing: NEVER, MANDATORY result in exceptions being thrown to the caller
- Correcting: NOT_SUPPORTED, REQUIRED result in the container correcting the transaction state
|
Failing |
Correcting |
---|
MANDATORY