Lesson 8 | Container-managed transactions |
Objective | Describe how container manages transactions on behalf of bean. |
NotSupported | Any existing transaction will be suspended before calling the method. The transaction will be resumed when the method returns.
Transactional access to resources will be local to the bean instance. No transactional context will be passed when other EJBs are invoked from this instance. |
Required | The invocation of the bean's method must be within the context of a transaction. The transaction may be started by client or further upstream. If there is no current transaction, then container will start one. If other beans are invoked, the transaction will be propagated. Transaction will be committed when the method returns. |
Supports | If the client calls the method within a transaction then it behaves the same as required control that is described above.
If the client calls without a transaction, it is the same as the NotSupported control. This is not the most useful control. Why not just use NotSupported? |
RequiresNew | If there is an existing transaction, it will be suspended and a new one started. If there is no existing transaction, a new one will be started. The transaction will be committed when the method returns. If there was a suspended transaction, it will be restarted. |
Mandatory | The client must call the method within the context of an existing global transaction. If there is no existing transaction when the call is made, the EJBObject will throw javax.transaction.TransactionRequiredException. |
Never | The client must never propagate a global transaction context. |