RE: Collection or list as return ??

2001-06-18 Thread Robert Hargreaves

We used ORDER BY in the finder method query in Orion 1.3.8 with no problems,
then moved to Orion 1.5.2 and they stopped working. Check which version of
Orion you're using.

 -Original Message-
 From: Eddie Post [mailto:[EMAIL PROTECTED]]
 Sent: 15 June 2001 23:48
 To: Orion-Interest
 Subject: Re: Collection or list as return ??
 
 
 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





RE: Collection or list as return ??

2001-06-16 Thread Eddie Post

Thanks jeff for clearing this up.

I will let the program order my collection.
I already have defined about 10 own finders in orion-ejb-jar.xml (otherwise 
it becomes to slow), so the application is already binded to orion and not 
fully J2EE compliant, but to also let the Db do the sort trick... Hmmm I 
little bit to much I think...

Eddie


From: Jeff Schnitzer [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 16:57:20 -0700

You're right, there is no guarantee from the spec that other app servers
will return data in order or even allow you to specify the ORDER BY
clause in the finder sql.  For that matter, there is no guarantee that
the database has a sql interface.

It gets even worse.  The current spec for EJB-QL has no support for
ordering.  The *only* way to write a 100% spec-compliant app which does
ordering is to implement the sorting yourself, in application code, in
Java.

It's pretty obvious to me at least that the people developing the EJB
specification have never actually used their ideas to develop a real
world application.  Fortunately for us, container vendors are less
insulated from the eventual customers; it's a pretty safe bet that most
servers will let you configure the ordering in the database query
somehow.  I wouldn't worry about it, but no, it's not standard.

Jeff Schnitzer

  -Original Message-
  From: Eddie Post [mailto:[EMAIL PROTECTED]]
  Sent: Friday, June 15, 2001 3:48 PM
  To: Orion-Interest
  Subject: Re: Collection or list as return ??
 
 
  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.




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





Re: Collection or list as return ??

2001-06-15 Thread Scot Weber

Eddie,

java.util.Collection is an interface, so chances are the real container
is a java.util.ArrayList, which is linearly sequential.  I don't know
this to be a fact, but it's just a thought . . .

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




Re: Collection or list as return ??

2001-06-15 Thread Scot Weber

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.




Re: Collection or list as return ??

2001-06-15 Thread Eddie Post

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.





RE: Collection or list as return ??

2001-06-15 Thread Jeff Schnitzer

You're right, there is no guarantee from the spec that other app servers
will return data in order or even allow you to specify the ORDER BY
clause in the finder sql.  For that matter, there is no guarantee that
the database has a sql interface.

It gets even worse.  The current spec for EJB-QL has no support for
ordering.  The *only* way to write a 100% spec-compliant app which does
ordering is to implement the sorting yourself, in application code, in
Java.

It's pretty obvious to me at least that the people developing the EJB
specification have never actually used their ideas to develop a real
world application.  Fortunately for us, container vendors are less
insulated from the eventual customers; it's a pretty safe bet that most
servers will let you configure the ordering in the database query
somehow.  I wouldn't worry about it, but no, it's not standard.

Jeff Schnitzer

 -Original Message-
 From: Eddie Post [mailto:[EMAIL PROTECTED]]
 Sent: Friday, June 15, 2001 3:48 PM
 To: Orion-Interest
 Subject: Re: Collection or list as return ??
 
 
 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.