Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic