HFEJB on page #545, Qn #1, says that none of the container call back methods can throw any application exceptions and can throw only EJBExceptions. I agree with that. On page 548, it says a RemoveException (a checked exception) can be thrown with the client's invocation of a remove() method, which I belive can be translated as "throw RemoveException from ejbRemove() method if needed". My question is how can you throw a checked exception like RemoveException, when this exception is not defined in the throws class of the interface?
This could be basic java and I am not connecting something/somewhere and please fix my understanding.
Both EJBObject and EJBhome declare ejbRemove() as
public void remove(Handle handle)
Remove an EJB object identified by its handle.
RemoveException - Thrown if the enterprise Bean or the container does not allow the client to remove the object.
java.rmi.RemoteException - Thrown when the method failed due to a system-level failure.
May be this will give a clue.
and remove is part of client (bcoz they are declared in home and ejbObject).
you can throw only unchecked exceptions from a container callback that is not part of your client view
Refer to page no 375 spec. (18.3.1)
while describing about business methods ejbRemove() is considered Business method !