Thanks Scott,

Thanks for the test (stupid that I didn't thought about that ;) ). So, yes 
the returned Collection (read: ArrayList) is a sorted one.
But how general is this, as I can't find anything in the J2EE spec about 
this and is it possible that Orion will change this such that it isn't 
sorted anymore ?


What do you think ? Let the DB do the "order by" or just let the sort method 
of Collections do the trick ? I have noticed that the sort method is very 
fast.


Eddie



>From: Scot Weber <[EMAIL PROTECTED]>
>Reply-To: Orion-Interest <[EMAIL PROTECTED]>
>To: Orion-Interest <[EMAIL PROTECTED]>
>Subject: Re: Collection or list as return ??
>Date: Fri, 15 Jun 2001 12:15:46 -0700
>
>Eddie,
>
>   I just tested it . . .
>
>MyTestHome.java __________
>
>   public interface MyTestHome {
>
>     ....
>     public Collection findAll () ...
>
>   }
>
>mytest.jsp__________
>
>   ....
>
>   <%= myTestHome.findall ().getClass () %>
>
>output_____________
>
>   java.util.ArrayList
>
>peace - scot
>
> > Eddie wrote:
> >
> > Hellu there,
> >
> > Some time ago someone made a remark that it make no sense putting a
> > "ORDER
> > BY" in the where clause in the orion-ejb-jar.xml, as the finder
> > methods of
> > the home interface do return a Collection, which are not sorted by
> > definition.
> >
> > Hmmm makes sence, but if I play around with it and put a "ORDER BY id
> > ASC"
> > or "ORDER BY id DESC" in the where clause in the orion-ejb-jar.xml, to
> > fine
> > tune some queries, it does  return sorted collections !!!!
> >
> > Howcome ?? Does the finder methods return a  sorted List as a J2EE
> > feature,
> > that is a subClass of a Collection, or is this just Orion. ??
> >
> > The thing is that I like to optimize my queries, but if this feature
> > isn't
> > J2EE for example I will have a problem with the following upgrades if
> > it's
> > left out for some reason !!
> >
> > BTW: in the J2EE spec, in section 10.5.6 they only talk about the
> > Collection
> > data type.!!
> >
> > Some advise please ??
> > Eddie
>
>--
>
>   scot weber - [EMAIL PROTECTED]
>   -------------
>   Given a choice between a folly and a sacrament, one should
>   always choose the folly -- because we know a sacrament
>   will not bring us closer to God and there's always a chance
>   that a folly will. - Erasmus
>
>   The only man who never makes a mistake is the man who
>   never does anything. - Theodore Roosevelt.
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


Reply via email to