Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 24028 invoked from network); 9 May 2006 15:08:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 May 2006 15:08:42 -0000 Received: (qmail 26365 invoked by uid 500); 9 May 2006 15:08:40 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 26108 invoked by uid 500); 9 May 2006 15:08:39 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 26092 invoked by uid 99); 9 May 2006 15:08:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 08:08:38 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of rickcr@gmail.com designates 64.233.184.239 as permitted sender) Received: from [64.233.184.239] (HELO wr-out-0506.google.com) (64.233.184.239) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 08:08:38 -0700 Received: by wr-out-0506.google.com with SMTP id 70so1248293wra for ; Tue, 09 May 2006 08:08:17 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=hlX8c83ywU0GsNOI0sMFlL+1gv+MV7mQgxkeM54IRg5NEakTGWXSO0sg8zxngipcNzkCCbmSNRBWIopiy7YWRREqxA4eOIp0vwHJDhfBiChnSBAPrYM00rJNr6tIYovzofzjMy6GDH3OsZAMYh8mmxaYUs7oG7Bspa1J2pUgEPw= Received: by 10.65.218.14 with SMTP id v14mr1658301qbq; Tue, 09 May 2006 08:08:16 -0700 (PDT) Received: by 10.64.150.4 with HTTP; Tue, 9 May 2006 08:08:16 -0700 (PDT) Message-ID: <583d4dff0605090808p7ae8fe15p9daff670de1a4daa@mail.gmail.com> Date: Tue, 9 May 2006 11:08:16 -0400 From: "Rick Reumann" To: user-java@ibatis.apache.org Subject: One query populating *multiple* lists per object returned MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I can manage the n+1 stuff using groupBy when I'm populating one List per object per level. Where I'm running into trouble is I want to have multiple Lists populated per object. An example will hopefully help clarify: Table PersonDog --------------- personID dogID dogName Table PersonCat --------------- personID catID catName Table Person ------------ personID personName =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Person Object ------------- List cats; List dogs; int personID; String personName; (Cat class and Dog class as well) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Now what I want back in one iBATIS query is a way to build a List of Person objects with the Lists of Cats and Dogs populated per person (assuming they have cats or dogs since either can be null). I'm not sure if it's a certain orderby in the sql I need to do or something I have to do with my iBATIS result maps to get both lists populated correctly. I CAN get this to work fine populating either Dogs or Cats (by themself) but I can't seem to create the correct query to get 'both' populated per person. For example for just Cats per peson, the below works (might be a typo in the below since I changed what I'm working on to Cats, Dogs, Person for sake of clarity): When I include the result property dogs and try to join in DOGS - LEFT JOIN Dog d ON p.personID =3D d.personID - I end up with too much duplicate data per Person when iBATIS builds my objects. I'm assuming I'm missing something simple and/or being a typical idiot and doing soemthing stupid? Thanks for any help.