I just found this problem.But I confuse about those answer.
Which is the true about the client's view of exception received from an ejb?
A) Receiving an application exception communicates to the client that the bean will no longer be accessible B) The client of a CMT bean can determine if the transaction has been roll back by calling the getStatus() method of the java.transaction.UserTransaction interface C) If the client receives an EJBException,the client must discontinue the transaction. D)If the client receives the java.rmi.RemoteException exception, the client will not typically know whether the method has completed.
------------------------------------------------------- When the first I read this question.I thought answer of this question is C. But I already read all answer.I confuse between C and D.
Would someone please explain reason to choose C or D is correct
Thank you for kindness
If I don't make dust. I may eat dust.<br />SCJP 1.4 ,SCWCD 1.4,SCBCD 1.3
C) If the client receives an EJBException,the client must discontinue the transaction.
Wrong. The Container has already rolled back the transaction and is simply informing the client.
D)If the client receives the java.rmi.RemoteException exception, the client will not typically know whether the method has completed.
Correct. RemoteException can be thrown for a large number of reasons. In fact, it can be thrown before the method even begins. For example, if a user calls a bean method with an invalid security role the Container will throw a RemoteException to a remote client.
Let's say that the transaction starts in a CMT client bean (A) which makes a local method call on another bean (B). If EJBException is then received by A, the Container will rollback A's transaction.
If A is a BMT bean, then A will probably end the transaction by invoking UserTransaction.rollback(). But note that if UserTransaction.setRollBackOnly() is invoked either in A or B (this assumes that A's transaction propgates into B, which must be a CMT bean with a Required, Mandatory or Supports transaction attribute), the Container will always rollback the transaction.
Back to question C: it is wrong because of the highlighted word "must":
If the client receives an EJBException,the client must discontinue the transaction.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Water! People swim in water! Even tiny ads swim in water:
a bit of art, as a gift, the permaculture playing cards