posted 17 years ago
When should the container throw NoSuchobjectException or NoSuchEntityException. The spec is little confusing in section 18.3.4.
As I understand, NoSuchEntityException should be thrown by Entity beans if the underlying entity has been removed from Database.
And NoSuchobjectException is should be thrown if the remove has been called prior to calling any method on the object.
Spec says in section 18.3.4: -
The NoSuchEntityException is a subclass of EJBException. If it is thrown by a method of an entity bean class, the Container must handle the exception using the rules for EJBException described in Sections 18.3.1, 18.3.2, and 18.3.3.
To give the client a better indication of the cause of the error, the Container should throw the java.rmi.NoSuchObjectException (which is a subclass of java.rmi.RemoteException) to a remote client, or the javax.ejb.NoSuchObjectLocalException to a local client.
Please help me understand.