• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sharpen your pencil page 547

 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have the answers for this exercise ?
 
Jonny Andersson
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was also looking for some "answers" to this Sharpen your pencil so lets continue this thread that was a good start: Kathy need your help -> Sharpen Your Pencil pg:547

I mostly agree in the answers suggested of Agasthya Iyer except for number 4 where B.Sathish has argumented very good for why it should be option A. I first answered C and D assuming that the checked exception is declared for the business method but after have read the arguments from B.Sathish do I fully agree in that it should be answer A.

But for the first one am I not sure. If the caught exception is not one that is declared or one that is an exception from a lower level, then is answer A the one that is correct. But if it is an exception that is declared for that method, would it then not be more correct to answer D and let the client know what went wrong? And they do not say that the bean is probably corrupt in the first scenario. I assumed that the exception is declared for the method and answered D. But comments to this would be appreciated!

[ June 23, 2007: Message edited by: Jonny Andersson ]

[ June 23, 2007: Message edited by: Jonny Andersson ]
[ June 23, 2007: Message edited by: Jonny Andersson ]
 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You catch a checked exception in a business method, and realize that your bean is probably corrupt.

Answer B: throw a RemoteException.

Do you agree ?
 
Jonny Andersson
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You catch a checked exception in a business method, and realize that your bean is probably corrupt.
Answer B: throw a RemoteException.
Do you agree ?


No, I don�t ... because you never throw a RemoteException from a bean. Instead you throw an EJBException which become a RemoteException if the client is remote and is delivered as is, as an EJBException, if the client is local. And with the EJBException that is a system exception do you also get rollback from the container without have to do it yourself explicitly as B.Sathish said in his post at http://www.coderanch.com/t/161347/java-EJB-SCBCD/certification/Kathy-your-help-Sharpen-Your
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic