• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can ejbRemove() throws RemoveException?

 
Patricia Wu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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?
 
Stefan Guilhen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic