The short answer is "random." Well, OK, it is more indeterminate. The
ordering is dependent on the database, which is indeterminate (as
Cayenne 1.1 doesn't do an ORDER BY clause when faulting relationships).
/dev/mrg
-----Original Message-----
From: Dhruti Ramani [mailto:dhrutiraman..ahoo.com]
Sent: Monday, November 07, 2005 4:12 PM
To: cayenne-use..bjectstyle.org
Subject: Re: Getting rows in right order from Database
ok i will try that but what I dont understand is how cayenne
returns a list? In what orders it returns, last modified object first,
first entered first out or what?
Andrus Adamchik <andru..bjectstyle.org> wrote:
For now if you really need to tweak how relationship is
fetched, you
may have to use a custom query and store returned list
as an ivar
somewhere instead of relying on default relationship
logic.
The other option that Neil mentioned (IndexPropertyList)
is not yet
available for DataContext... But it will be soon.
Andrus
On Nov 7, 2005, at 11:26 PM, Dhruti Ramani wrote:
> Thanks for replying. I was aware of this but when we
have a query
> that returns large number of rows then its not a good
idea to get
> the list and then sort it.
>
> Thanks,
> Denna
>
> Neil Pierson wrote:
> To the best of my knowledge, relationships do not
return objects
> with an order. You can do something like this:
>
> List list = someObject.getRelatedObjects;
>! Ordering ord = new Ordering
> (RelatedObjects.SOME_PROPERTY, Ordering.ASC);
> ord.orderList(list);
>
> On 11/7/05, Dhruti Ramani wrote:
> I am using cayenne1.1 and Postgresql as my database. I
have two
> objects Address and USState and 1 to M relation
between them. Every
> time i print a list of USStates it prints in different
order, like
> sometime NY, NJ, and sometime NJ, NY. I am not using
any Ordering.
> Is there a way to tell cayenne that get the list in
some order? For
> getting the list i am using method that cayenne
provides.
>
> Thanks,
> Denna
________________________________
Yahoo! FareChase - Search multiple travel sites in one click.
<http://us.lrd.yahoo.com/_ylc=X3oDMTFqODRtdXQ4BF9TAzMyOTc1MDIEX3MDOTY2OD
gxNjkEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw--/SIG=110oav78o/**http%3a//
farechase.yahoo.com/>
This archive was generated by hypermail 2.0.0 : Mon Nov 07 2005 - 16:34:51 EST