• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Let me start! -- NoSuchEntityException

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Kathy and all EJB Developers,
My question is:
Does the statement below mean that if NoSuchEntityException is thrown, say, from ejbLoad() or ejbStore() then what the client gets is java.rmi.NoSuchObjectException, because it is re-thrown by the Container as NoSuchObjectException?
EJB Specs:
18.3.4 javax.ejb.NoSuchEntityException
____________________________________
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.
____________________________________
Thank you very much!
+Seid
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's move it up a bit :-)
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it means just that. Didn't you ever have this exception from the container?
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I almost missed this one! After all the, um, *discussions* about the beta exam, I didn't realize that someone raised an honest to goodness technical question. Yay
Anyway, the "NoSuchObjectException" is not guaranteed for the client, although the container is "encouraged" to throw that. When you throw a NoSuchEntityException from, say, your ejbLoad method (for a BMP bean, when you discover to your horror that someone deleted this entity from the underlying persistent store / database), the container IS required to handle it in the same way that it would handle any other EJBException.
A *nice* container will give the client a "NoSuchObjectException" to give them a better idea about what happened, but a container isn't required to do so. If the client tries to refind that same entity with a single-object finder, they'll get an ObjectNotFoundException.
And boy oh boy is it tough to remember the difference between NoSuchObjectException and ObjectNotFoundException. The only way I remember those is by keeping in mind the word "Found" in ObjectNotFoundException -- which reminds you that this exception is a FinderException! That means the other one (NoSuchObjectException) must be the standard RMI Exception that a client gets when they have a stub to a remote object, and the remote object no longer exists. (Or, for the new 'local' version, that the local interface implementation being referenced no longer exists).
I'm so happy: a real question from the spec
Cheers,
Kathy
OK, let's have some more!
 
Enjoy the full beauty of the english language. Embedded in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic