This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

NoSuchEntityException & NoSuchobjectException confusion

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,
Trupti
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NoSuchEntityException is an exception thrown by the bean to inform the container that the entity is missing. This can happen when the entity is removed (possibly by other means) from the persistent store.

If an attempt is made to invoke a method on an object that no longer exists, a NoSuchObjectLocalException or NoSuchObjectException will be thrown to the local or remote client respectively.

NoSuchEntityException is thrown by the bean to the container
NoSuchObject(Local)Exception is thrown by the container to the remote/local client
[ February 21, 2006: Message edited by: Ramakrishnan Viswanathan ]
    Bookmark Topic Watch Topic
  • New Topic