Transaction Annotations
also see Testing Transactions for an example of how to use and test EJB transaction attributes
...
| Failing | Correcting | No Change |
---|---|---|---|
Transacted | MANDATORY | REQUIRED, REQUIRES_NEW | SUPPORTS |
Not Transacted | NEVER | NOT_SUPPORTED | SUPPORTS |
The "Transacted" and "Not Transacted" represent whether or not an existing transaction is in progress when the call is made. The "Failing", "Correcting", and "No Change" headers represent the action take by the container in the case where an existing transaction is or is not in progress.
For example, Never and Mandatory are categorized as "Failing" and will cause the container to throw an exception to the caller if there is (Tx Never) or is not (Tx Mandatory) a transaction in progress when the method is called. The attributes Required, RequiresNew, and NotSupported are categorized as "Correcting" as they will cause the container adjust the transactional state automatically as needed to match the desired state, rather than throwing an exception.
MANDATORY
A MANDATORY method is guaranteed to always be executed in a transaction. However, it's the caller's job to take care of suppling the transaction. If the caller attempts to invoke the method outside of a transaction, then the container will block the call and throw them an exception.
...