• 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Sharpen your pencil in page 547 of HFE !

Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,
I am not sure of the answers for the exercise on page 547 for the responsibilities of a bean provider. I want to know if the options I have selected are correct ?
Options :
A.Throw an EJBException
B.Throw a RemoteException
C.Invoke setRollbackOnly()
D.Allow the exception to propagate
Scenarios :
1.You catch a checked exception in ejbActivate method. The method is not in a transaction – A
2.A RuntimeException occurs in the business logic and no try/catch is present – D
3.You throw a CreateException for ejbCreate methods and realize that we cannot safely complete the transaction – A, C
4.You catch a checked Exception in a business method, realize that bean is probably corrupt – A,C
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Reghu,
I think that 3 is C only and and 4 is A only.
3: How could you throw an EJBException while you are throwing a CreateException ?
4: C is not needed as the container will rollback the transaction anyway after you have thrown an EJBException.
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic