But this goes back to my point on releasing specs early is not a good thing
or in the communities interests. See the early public drafts of EJB 1.1
still had the confusing phrasing of saying a "null collection" was returned.
Some containers (Ill be polite) who released EJB 1.1 early implemented this
as per the confusing phrase, this allowing you to return a null collection
rather then an empty collection. This caused developers to implement their
finders illegally by returning null collections, leading to big portability
issues. I still contend that releasing implementations of specifications
before they are final is a dis-service to the community. Developers should
be very aware that by implementing applications early using containers with
partial, pre-released implementations of a specification put them at a
significatn portability risk. Since one of EJB's biggest advantages is
portability, you should approach such pre-release implementations with care
and forethought.
Dave Wolf
Internet Applications Division
Sybase
----- Original Message -----
From: "Dan Christopherson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 16, 2001 5:43 PM
Subject: Re: Null or empty collection
> As others have pointed out, the spec is quite clear that it should be an
> empty collection and that this is a collection containing 0 elements.
>
> On Sat, 17 Feb 2001, Wong Kok Wai wrote:
>
> > 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".
> >
>
> --
> Dan Christopherson (danch)
> nVisia Technical Architect (www.nvisia.com)
>
> Opinions expressed are mine and do not neccessarily reflect any
> position or opinion of nVISIA.
>
> --------------------------------------------------------------------------
-
> If you're a capitalist and you have the best goods and they're
> free, you don't have to proselytize, you just have to wait.
> -Eben Moglen
>
>
===========================================================================
> 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".
>
>
===========================================================================
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".