Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

this question has been posted mant time, but...

 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
following question has been posted in this forum, butI can not understand the sentance "The bean cannot recover from this checked exception", does it mean the exception has been handled by container? if so, the container rolls transaction back and throws an EJBException, that is to say no given options are proper for this question. do you think so?
EJB business method performs an operation that
throws a checked exception. The bean cannot recover from this checked exception and should rollback. The bean will be deployed using
container-managed transaction demarcation. Which
implementation is the BEST?
A. public void businessMethod() { try { // operation
throwing
SomeCheckedException goes here }
catch (SomeCheckedException ae) { throw new
EJBException(ae); } }
B. public void businessMethod() { try { // operation
throwing
SomeCheckedException goes here }
catch (SomeCheckedException ae) {
context.setRollbackOnly(); throw
new EJBException(ae); } }
C. public void businessMethod() throws EJBException
{ try { //
operation throwing
SomeCheckedException goes here } catch
(SomeCheckedException ae) {
throw new EJBException(ae); }
}
D. public void businessMethod() throws EJBException
{ try { //
operation throwing
SomeCheckedException goes here } catch
(SomeCheckedException ae) {
context.setRollbackOnly();
throw new EJBException(ae); } } }}
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Originally posted by Timber Lee:
I can not understand the sentance "The bean cannot recover from this checked exception"

This basically means the EJB does not have the necessary information to properly handle this error condition. Obviously, something has to take place, however we know that the situation can not be "corrected" in our EJB. The question is asking, in this type of situation, what should the EJB do?
[ March 27, 2003: Message edited by: Chris Mathews ]
 
Timber Lee
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my answer is "D", is it correct?
[ March 27, 2003: Message edited by: Timber Lee ]
reply
    Bookmark Topic Watch Topic
  • New Topic