• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

question from ejbcertificate

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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.
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic