This week's book giveaway is in the Python forum.
We're giving away four copies of High Performance Python for Data Analytics and have Tiago Rodrigues Antao on-line!
See this thread for details.
Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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.
 
Die Fledermaus does not fear such a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic