The JavaDoc for ObjectNotFoundException put it as:

<quote>
This exception should not be thrown by
finder methods that return a collection of EJB objects (they should return a null
collection instead).
</quote>

Let me rephrase my original question: is there a difference between a null
collection and an empty collection? To me, they mean different things.

Dan Christopherson wrote:

> You don't throw ObjectNotFoundException in this case: it's documentation
> just included a red herring on the real issue.
>
> >From the 1.1 spec, section 9.1.9.4:
> "Only single-object finders (see Subsection 9.1.8) should throw this
> exception. Multi-object finders must not throw this exception.
> Multi-object finders should return an empty collection as an indication
> that no matching objects were found."
>
> On Fri, 16 Feb 2001, Tim Endres wrote:
>
> > Maybe I do not understand the question, but if you are throwing an
> > ObjectNotFoundException, isn't the returned value meaningless?
> >
> > tim.
> >
> > > I'm a bit confused what should be returned by finders that return
> > > multiple objects. In the EJB 1.1 specs, it is stated an empty collection
> > > should be returned. However, in the JavaDocs for
> > > ObjectNotFoundException, it is stated a null collection should be
> > > returned. My understanding is null collection is null, and an empty
> > > collection is a collection with zero elements. So which should I return
> > > (I prefer the empty collection approach, as it simplifies both the bean
> > > and client implementations)?
> > >

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