Please comment on the truth ness of the following comments...
1. Container is not responsible for committing or rolling back transactions that have been initiated by the client. 2. The container is only responsible for rolling back a system exception for an message-driven bean with container-managed transaction demarcation and when the bean method runs in the context of a transaction started by the container. A transaction is not rolled backed by the container as a result of a system exception thrown when the transaction runs with an unspecified transaction context and also when a bean is declared with bean-managed transaction demarcation.
And what should be the correct answer for the following question... Question: What will the container do when a bean managed message driven bean throws a system exception? [Check all correct answers] 1. Log the system exception. 2. Mark the transaction for rollback. 3. The container will discard the message driven bean instance and will not invoke any business methods or container callbacks on the instance. 4. The container will commit the transaction unless the deployment descriptor specifies otherwise. 5. The client will receive a RemoteException.
As per the given answer... option 1, 2, and 3. I am confused as MDB is a BMT bean so option 2 should not be true.
Option 2 is correct. Remember, a transaction is scoped at method level. So, if a system exception is thrown, the container must ensure that the transaction is ended. (We are assuming that the exception is not handled.) This is done by marking for rollback a transaction that has been started, but not yet completed, by the instance.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
His brain is the size of a cherry pit! About the size of this ad: