• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Checked exceptions from...'EJB' methods

 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got a doubt: what shall I do from an 'EJB' method if a checked exception is catched. Of the 6 bean developer's responsibilities in case of EJB exceptions, I don't remember any of these referring explicitly to EJB methods (ejbCreate, ejbActivate and so on). Following what is written in HF in case of checked exceptions catched in a business method in case of transactions, I should invoke setRollbackOnly() before catching (actually re-catching) the exception and also declare it either in the bean class and in the client's interfaces and let it propagate to the container (so that it will propagate it to the client as it is). But I remember that I shouldn't declare checked exceptions in the container callbacks methods (or I am wrong?).

It's getting late.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's right. You cannot modify the throws clause of EJB methods to add application-specific exceptions except for the ejbCreate<METHOD>() methods since they are not declared in any bean interface.

Actually, application exceptions should be thrown by your business methods and not from the EJB methods since the latter are not supposed to perform operations related to your business but more life-cycle related stuff. I don't see how/why you would need to throw an application exception from an EJB method.

Does it make sense to you?
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Valentin Crettaz:

Does it make sense to you?



Yes it does, thank you.
 
Evildoers! Eat my justice! And this tiny ad's justice too!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic