Forums Register Login

Transaction Problem

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
about C
if the transcation is CMT ,it will rollback;
but if the transcation is Client transcation ,what can you do?
+Pie Number of slices to send: Send
about C
if the transcation is CMT ,it will rollback;
but if the transcation is Client transcation ,what can you do?

I think its upto the client to decide whether to rollback the transaction or not, if the client has its own transaction.
+Pie Number of slices to send: Send
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.

 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 666 times.
Similar Threads
question from ejbcertificate
Few Questions
Transaction Question
RemoteException
Doubt on Whizlabs Mock Test Question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:53:58.