• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Throwable

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
We can walk to school together. And we can both read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic