.. a javax.ejb.EJBTransactionRolledbackException ..
The question statement says the invocations are local, thusly:
Assuming all invocations are local<snip>
But the API for EJBTransactionRolledbackException says
This exception is thrown to a remote client<snip>
Perhaps the blue explanation needs to be changed to reflect another exception. Could it be "TransactionRequiredLocalException"? Hope I did not snip anything relevant, though I added the API link below for verification.
There is a bit of inconsistency in the JavaDoc and EJB 3.1 Specification.
As per Table 15 in Section 14.3.1 (which is meant for session beans) of the specification, the client should receive javax.ejb.EJBTransactionRolledbackException. It further says in NOTE D, "If the business interface is a remote business interface that extends java.rmi.Remote, the javax.transaction.TransactionRolledbackException is thrown to the client, which will receive this exception."
To make matter worse, Table 17, section 14.3.2, "Exceptions from Method Invoked via Session or Entity Bean’s 2.1 Client View or through Web Service Client View" clearly says, "Throw javax.transaction.TransactionRolledbackException to remote client; throw javax.ejb.TransactionRolledbackLocalException to local client."
So it is clear that the Specification authors have made a distinction between EJBTransactionRolledbackException and TransactionRolledbackLocalException and since EJB 2.1 is not really relevant for this exam, we should go with Table 15.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
As I understand bean A is not called in the context of client transaction, because bean A has transaction attribute RequiresNew. Does not that mean that bean method runs in the context of a transaction that the container started immediately before dispatching the business method and therefore javax.ejb.EJBException is thrown instead of javax.ejb.EJBTransactionRolledbackException?
johnlong wrote:I understand now. So can we say that EJBTransactionRolledbackException is wrapped into EJBException in mA and then re-thrown to the client?
No, the specification doesn't mention that EJBTransactionRolledbackException is wrapped into an EJBException in this case but it is certainly possible and makes sense.
If you like our products and services, please help us by posting your review here.