Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

HF Book Doubt on Exception

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
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.

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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic