Saturday, February 7, 2009

SCEA1.5 - Transaction Attributes

Transactional attributes of bean methods are specified in the deployment descriptor. Here are the attributes and what they mean :

TX_BEAN_MANAGED: The bean programmatically controls it’s own txEJB 1.0 Only boundaries via JTA.

NotSupported: The bean CANNOT be involved in atransaction at all. When a bean method is called, any existing tx is suspended.

Required: The bean must ALWAYS run in a transaction. If a tx is already running, the bean joins in that tx. If not, the container starts a tx for you.

RequiresNew: The bean must ALWAYS run in a NEW transaction. Any current tx is suspended.

Supports: If a transaction is underway, the bean joins in that tx, otherwise runs with no tx at all.

Mandatory: Mandates that a transaction must already be running when the bean method is called or an exception is thrown back to the caller.

Never: If a tx is underway the bean will throw aEJB 1.1 Only RemoteException, otherwise the methodRuns normally without a tx.