Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 68937 invoked from network); 19 Feb 2010 19:44:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Feb 2010 19:44:59 -0000 Received: (qmail 80603 invoked by uid 500); 19 Feb 2010 19:44:59 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 80581 invoked by uid 500); 19 Feb 2010 19:44:59 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 80571 invoked by uid 99); 19 Feb 2010 19:44:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2010 19:44:59 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of luke@foolishgames.com does not designate 76.96.30.56 as permitted sender) Received: from [76.96.30.56] (HELO qmta06.emeryville.ca.mail.comcast.net) (76.96.30.56) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2010 19:44:50 +0000 Received: from omta01.emeryville.ca.mail.comcast.net ([76.96.30.11]) by qmta06.emeryville.ca.mail.comcast.net with comcast id ju4L1d0010EPchoA6vkWnM; Fri, 19 Feb 2010 19:44:30 +0000 Received: from stargazer.midnightbsd.org ([70.91.226.201]) by omta01.emeryville.ca.mail.comcast.net with comcast id jvkU1d00H4MLobJ8MvkV9M; Fri, 19 Feb 2010 19:44:29 +0000 Received: from [192.168.0.42] (75-151-13-201-Michigan.hfc.comcastbusiness.net [75.151.13.201]) (authenticated bits=0) by stargazer.midnightbsd.org (8.14.4/8.14.4) with ESMTP id o1JJiM9x065695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 19 Feb 2010 14:44:27 -0500 (EST) (envelope-from luke@foolishgames.com) X-Authentication-Warning: stargazer.midnightbsd.org: Host 75-151-13-201-Michigan.hfc.comcastbusiness.net [75.151.13.201] claimed to be [192.168.0.42] Message-ID: <4B7EEA16.1040003@foolishgames.com> Date: Fri, 19 Feb 2010 14:44:22 -0500 From: Lucas Holt User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: user@cayenne.apache.org Subject: Re: Relationship & Sort Ordering References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (stargazer.midnightbsd.org [70.91.226.201]); Fri, 19 Feb 2010 14:44:27 -0500 (EST) Joe Baldwin wrote: > I need to sort-order a list returned from a to-many relationship. It is logical that this ordering be applied in all cases. > > Question: > Is there a simple way to apply this by modifying the SelectQuery associated with the relationship or should I just sort order the list each time it is returned? > > (If I missed it in the docs please send me a link.) > > Thanks, > Joe > > Look at the documentation on "orderings". For cayenne 3, final SelectQuery query = new SelectQuery( Company.class ); query.setPageSize( 50 ); query.addOrdering( "companyName", SortOrder.ASCENDING ); final List c = dataContext.performQuery( query ); Lucas