"If a remote client in a transaction context invokes a business method on a bean with container-managed transaction, the client receives ______ if the bean instance throws a non-application exception? [Enter exception including its package name]"
requested answer is javax.transaction.TransactionRolledBackException
according to 18.3.1 of the specification, the client will only recieve a javax.transaction.TransactionRolledBackException (or javax.ejb.TransactionRolledBackLocalExcpetion) if the bean method executes in the context of the callers transaction (this provides additional information to the client that their transaction is doomed).
since the tranactional attribute of the bean method in this question is unclear (it could be REQUIRESNEW which would not run in the context of the callers transaction), and since javax.transaction.TransactionRolledBackException extends from javax.rmi.RemoteException, I think the more correct answer to this quiestion would be: javax.rmi.RemoteException.
I think that in order to answer that the client recieves a TransactionRolledBackException, there should be clear indication to the fact that the bean method will run in the context of the callers transaction and explicitly not in its own transaction.
hopefully sun's exam question/answers don't model this one.
You are correct. The question is ambiguous. Question must clarify about transaction context of Bean method as either of following: 1] Bean method runs in context of the caller�s transaction 2] Bean method runs in context of a transaction that the Container started immediately before dispatching the business method. 3] Bean method runs with an unspecified transaction context.
The exception thrown by Container would differ based on the above mentioned. Client would receive javax.transaction.TransactionRolledBackException, if business method has transaction attribute as either Required, Mandatory, and Supports in this case.
So what transaction attribute is specified for business method on a bean must have been specified in question.
Rest assured. Actual Certification test would not have such ambiguous questions as per my past experience.
Regards,<br />Sandesh<br />(SCJCP, SCWCD, SCBCD - 99%, OCP-1)<br /> <br />Either find a way or create one.