Victor Langelo wrote:

> 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.
>

I know that the CMP engine of IAS has such an option. Their argument is that you still
have to handle the not found error at the invocation of every business method, as 
another
client of the bean could very well delete it between the finder call and the business
method (as well as between the business method calls). Of course, it depends on the 
kind
of application and the kind of bean you're using.

JB.

>
> --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".

--
Jean-Baptiste Nizet
[EMAIL PROTECTED]

R&D Engineer, S1 Belgium
Kleine Kloosterstraat, 23
B-1932 Sint-Stevens Woluwe
+32 2 200 45 42

===========================================================================
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