File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HFE + removeException() p.550 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "HFE + removeException() p.550" Watch "HFE + removeException() p.550" New topic
Author

HFE + removeException() p.550

cyril vidal
Greenhorn

Joined: Nov 02, 2004
Posts: 14
Hi,

In HFE p.550, it is said hat you always can throw a RemoveException from your ejbRemove() method in case of stateless session bean (even if the client will never see it).

To my sense, because the ejbRemove() method from SessionBean interface doesn't declare the javax.ejb.RemoveException (application exception), you are NEVER allowed to throw a RemoveException in a SessionBean's ejbRemove() method, either a stateless or stateful one.

So to my sense, You only may prevent removal from entity beans because the ejbRemove() method of EntityBean precisely declares javax.ejb.RemoveException...

Am I correct here?

Thanks for your responses,
Cyril.
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Hmmm, interesting. Good catch.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I've given this a bit thought and can't think why you would want to prevent the deletion of a stateful session bean. A client creates the session and so it would be a bit strange if there was code to prevent it being deleted in the bean class. As the instance can only be used to service that one client which it was created by and no others.

A container might want to prevent the deletion say, if the bean was using BMT and the client was in the middle of a transaction. That's the only reason I could think of that a stateful session bean might not be deleted.

Is my thinking correct?
 
GeeCON Prague 2014
 
subject: HFE + removeException() p.550