• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sharpen your pencil in page 547 of HFE !

 
Reghu Ram Thanumalayan
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • 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
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • 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.
Best,
Phil.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic