• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF Book Doubt on Exception

 
Deepika Pereira
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On P 559 Client Scenarios (1) says the exception will be RemoteException for Remote i/f and EJBException for local when client calls a remove on an already removed bean.My doubt is why the NoSuchObjectException is not thrown ?

What are conditions under which it is thrown then because as per the book it is thrown when the client invokes a method on a home or component i/f when there is no underlying bean to support the object


Please clarify
 
M. Imran
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only container can throw NoSuchEntityException but client will not able to see it ever.

Calling remove() on a bean already removed is just any other method called on bean e.g. create, getHome etc. and all get RemoteException for remote client and EJBException for local clients.

Imran
 
Arun Natarajan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too think the NoSuchObjectException and NoSuchObjectLocalExcecption should be thrown. However in a question if these exceptions are not available, then it would not be wrong to say RemoteException (or EJBException) will be thrown because these are the parent classes.

The NoSuchEntityException Imran is talking about is something that you can throw from your bean method when you find that the underlying entity is no longer in the database(typically used in BMP entity beans). This will be rethrown by the container as a NoSuchObjectExcecption.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic