• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Transaction Problem

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
about C
if the transcation is CMT ,it will rollback;
but if the transcation is Client transcation ,what can you do?
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic