Two Laptop Bag*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes question from ejbcertificate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "question from ejbcertificate" Watch "question from ejbcertificate" New topic
Author

question from ejbcertificate

Mark Lybarger
Ranch Hand

Joined: Dec 19, 2003
Posts: 72
"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.
Sandesh Tathare
Ranch Hand

Joined: Jun 22, 2003
Posts: 82
Mark,

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question from ejbcertificate