HJEJB Page 425, Question 3:
When a remote client invokes a method on an entity bean using container-managed persistence, and that bean has already been removed, what exception will be thrown?
I'm not challenging the provided solution. What I'm trying to say here is that the question is rather unclear here. Were they looking for the exception thrown by the bean or by the container?
If it was asking for the exception thrown by the container, the provided solution is obviously correct.
But I could also argue that the bean throws NoSuchEntityException, and that is also correct. Moreover, the question did not state what method was invoked. It could be remove, ejbLoad, ejbStore or any business methods defined in the component interface.
But of course to the client, it could see RemoteException/EJBException or the more specific NoSuchObjectException/NoSuchObjectLocalException.