EJB 1.0: Exceptions and Transactions
In EJB 1.0, the impact of exceptions on
transactions largely depends on who initiates the transaction. A
transaction that is started automatically when a bean method is
invoked is a container-initiated transaction. Specifying the
TX_REQUIRES_NEW transaction attribute, for
example, always results in a container-initiated transaction. A
TX_REQUIRED method invoked by a non-transactional
client also results in a container-initiated transaction. A
transaction that is started explicitly using JTA (on the client or in
TX_BEAN_MANAGED bean) is not a
With container-initiated transactions, any exception thrown during a transaction can cause the transaction to roll back. The impact of an exception thrown during a transaction depends on the type of exception (checked or unchecked) and the transaction attribute of the bean method throwing the exception. This section examines the different combinations of exceptions (checked or unchecked) and transaction attributes and their combined affect on transactional outcomes.
Any exception (application
exception, unchecked exception, or
RemoteException) not handled
within the scope of the container-initiated transaction causes the
container to roll back the entire transaction.
An exception that is not handled within the scope of container-initiated transaction is an exception that is propagated, through the call stack, beyond the bean method ...