Return-Path: Delivered-To: apmail-db-ojb-user-archive@www.apache.org Received: (qmail 79695 invoked from network); 1 May 2004 07:20:57 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 1 May 2004 07:20:57 -0000 Received: (qmail 32460 invoked by uid 500); 1 May 2004 07:20:29 -0000 Delivered-To: apmail-db-ojb-user-archive@db.apache.org Received: (qmail 32438 invoked by uid 500); 1 May 2004 07:20:29 -0000 Mailing-List: contact ojb-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Users List" Reply-To: "OJB Users List" Delivered-To: mailing list ojb-user@db.apache.org Received: (qmail 32425 invoked from network); 1 May 2004 07:20:29 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by daedalus.apache.org with SMTP; 1 May 2004 07:20:29 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BJong-0002eL-00 for ; Sat, 01 May 2004 09:20:40 +0200 Received: from p83.129.127.157.tisdip.tiscali.de ([83.129.127.157]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 May 2004 09:20:40 +0200 Received: from t.schoellhorn by p83.129.127.157.tisdip.tiscali.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 May 2004 09:20:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: ojb-user@db.apache.org From: =?ISO-8859-1?Q?Tino_Sch=F6llhorn?= Subject: Re: Collection creation and sorting Date: Sat, 01 May 2004 09:20:32 +0200 Lines: 83 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: p83.129.127.157.tisdip.tiscali.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en In-Reply-To: Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi Gelhar, the thing is: I have a decomposed N:M-relationship and the attributes after which I want to sort the collection are members of different classes! Any ideas? Tino Gelhar, Wallace Joseph wrote: > Hi Tino, > > Sure you can do this. An example: > > > ... > name="rooms" > element-class-ref="RoomImpl"> > > > > > ... > > > Where roomNo and roomSuffix are attributes on the RoomImpl object. > > Wally > -----Original Message----- > From: news [mailto:news@sea.gmane.org] On Behalf Of Tino Sch�llhorn > Sent: Friday, April 30, 2004 2:41 AM > To: ojb-user@db.apache.org > Subject: Collection creation and sorting > > > Hi, > > I have a (probably simple) question about sorting collections: > > I have 3 classes which I successfully mapped to OJB: > > class Company { > Collection companyTeams; > > public Collection getTeams() { > //??? > } > } > > class CompanyTeam { > Company c; > Team t; > int pos; > } > > class Team { > String name; > Collection companyTeams; > } > > Now I want to achieve the following: The method getTeams() of class > Company should return all Teams of that Company *sorted by > CompanyTeam.pos AND Team.name*. > > I know that I could write a quite complicated Comparator which just does > that - but I have many other cases where I had to do that. And writing > Comparators is not fun and is very error prone. > > Is there a way to tell OJB that it should load the Collections in a such > ordered fashion? I know that one can specify several orderby attributes > but is it also possible to specify the orderby attributes which are > located in different tables? > > Or should I implement a QueryCustomizer? > > In hope for help. > tino > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-user-help@db.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org For additional commands, e-mail: ojb-user-help@db.apache.org