• Post Reply Bookmark Topic Watch Topic
  • New Topic

Throwable

 
Tmmet Johnson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a stateless session bean.I call my Data Access Object (DAO) class from my ejb method.
Can I catch Throwable in my DAO method ?
In the Throwable block, I am planning to throw an application exception.
Is there any drawback in this approach.Since, catching Throwable catches error and all runtime exceptions, there will not be any work for the EJB Container when a runtime exception occured.Is this the good way?
Please let me know.
h
 
Ådne Brunborg
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't.

Why do you want to catch Throwable? Is there anything you can do in your code when a Throwable which isn't an Exception occures?

I would catch only checked exceptions in the DAO layer, and possibly catch unchecked exceptions in the EJB in order to throw your application exeption to the client.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!