In addition to what Richard said, there's the problem that ejbLoad probably won't be
called until a business method is invoked. So the user must handle the not found error
at the invocation of the first business method instead of the finder method.

--Victor Langelo


Richard Monson-Haefel wrote:

> While I agree that simply returning the primary key is more efficient then checking
> for the entity in the database, there are drawbacks to this strategy.
>
> Here is the problem: If the entity doesn't exist in the database then the activated
> instance will throw an exception in its ejbLoad method which will result in a
> transaction rollback.
>
> This rollback is avoided with the ejbFind method that checks for the entity, because
> it  throws an application exception (ObjectNotFoundException), which doesn't cause a
> transaction rollback.  Generally we don't expect the ejbFind method to cause a
> transaction rollback if there is no entity is found.  In addition, the contract of
> the find operation is broken. Instead of throwing an ObjectNotFoundException, as
> expected, the find method will throw a RemoteException.
>
> As long as the bean developer and application developer are aware of these
> differences the change in behavior (which does not conform with the specification)
> is perhaps tolerable.
>
> Richard
> --
> Richard Monson-Haefel
> Author of Enterprise JavaBeans, 2nd Edition
> Published by O'Reilly & Associates
> http://www.EjbNow.com
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to