Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thorwn Exception of local

 
phenix java
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Q3 HFEJB Page 425
When a remote client invokes a method on an entity bean using container-managed persistence, and that bean has already beean removed ,what exception will be thrown?
ans java.rmi.NoSuchObjectException

As case.If local client called method ? what exception will be thrown?

would you please advice me
Thank a lot for your kindly advice
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.ejb.NoSuchObjectLocalException
 
amol deshpande
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
local clients will get javax.ejb.NoSuchObjectLocalException
remote clients will get javax.ejb.NoSuchObjectException

Bye
Amol.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic