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
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!
Don't play dumb with me! But you can try this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!