• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Can ejbRemove() throws RemoveException?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On page 550 of Head First EJB, "You can throw a RemoveException from your ejbRemove() method...". Does that mean you can do "public void ejbRemove() throws RemoveException" in your bean class? But on page 545, "You can throw only unchecked exception from a container callback..." and RemoveException is a checked exception. Do I miss anything here?
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peiqun

Page 545 says that "You can throw only unchecked exceptions from a container callback that is not part of your client view". But ejbRemove is a callback that is part of the client view (the remove methods in the home and component interfaces). If you check the J2EE API, you will see that the remove methods from both EJBHome and EJBObject declare the RemoveException in the throws clause. So, you can safely throw a RemoveException from you bean class.

Hope this helps,
Stefan
 
I think she's lovely. It's this tiny ad that called her crazy:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic