• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

NoSuchEntityException & NoSuchobjectException confusion

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
What a show! What atmosphere! What fun! What a tiny ad!
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic