• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the meaning of this Enthuware's answer

 
Chaminda Amarasinghe
Ranch Hand
Posts: 404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Here is one of correct answer (according to enthu) for a question of enthu-ejb+ (Test 3, Q 23)

If it is a checked exception that is not listed in the throws clause of the method and if the bean cannot recover from this exception, the bean method should throw the javax.ejb.EJBException that wraps the original exception.


Dear Paul Anil, Can you (or your exam development team) please teach me how a method can throw checked exception without defining in throws clause.

Thanks
[ November 12, 2008: Message edited by: Chaminda Amarasinghe ]
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3711
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Chaminda,
It will make sense if you read it in the presepective of what the question is asking, "What is the responsibility of the bean provider if his session bean method gets an exception during execution of its method body?"

Code within the method of a session bean may throw either a checked or an unchecked exception. It is not necessary that all the checked exceptions that are received while executing the method body are listed in the throws clause of the method. You can also put such a piece of code in a try-catch block. This is the scenario that the option you refered to is talking about. If you, as a bean developer, believe that such an exception is detrimental to the bean process and if you don't want to list that exception in the throws clause, you shoul throw an EJBException that wraps the original exception.

If you (or any one else readin this) have any thoughts how to reconstruct the option to avoid such confusion, please do share. We will really appreciate your feedback.

HTH,
Paul.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anil,

Thanks for the help,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic