1) A BMT session bean starts a transaction in a business method
2) Before the txn is committed, a system exception occurs
3) According to specs (page: 377, Table 16), container would mark the transaction for rollback and discard the bean.
Question: When will the transaction be rolled back ? Is it when the bean is discarded ?
yes, when a bean throws a system exception to the container, the container kills the bean, does a rollback of the transaction, logs the exception and throws a RemoteException to remote clients and EJBException to local clients irrespective of whether it is CMT or BMT. This would typically happen immediately after the exception is thrown
Container does the rollback of transaction only if it has started the transaction. In case of BMT (according to specs 377, Table 16, page 378 Table 18), container only marks the transaction for rollback.
So my question once again: In case of BMT after a system exception is thrown When does the rollback of txn happen ?
Abandoned transaction as good as committed transaction
How can it be ? Committed transaction - releases resources / locks etc.
Abandoned transaction - the txn is live holding on to resources / locks.