Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 67438 invoked from network); 23 Jun 2005 15:47:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Jun 2005 15:47:30 -0000 Received: (qmail 31823 invoked by uid 500); 23 Jun 2005 15:47:29 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 31801 invoked by uid 500); 23 Jun 2005 15:47:29 -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 31782 invoked by uid 99); 23 Jun 2005 15:47:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jun 2005 08:47:28 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [63.99.224.18] (HELO vickerscraven.net) (63.99.224.18) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jun 2005 08:47:29 -0700 Date: Thu, 23 Jun 2005 10:47:17 -0500 Message-Id: <200506231047.AA216596708@vickerscraven.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable From: "Aaron Craven" Reply-To: To: , , Subject: Re: Avoiding N+1 selects with more complex graphs X-Mailer: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Okay, many thanks to everyone for their help! ---------- Original Message ---------------------------------- From: Larry Meadors Reply-To: lmeadors@apache.org Date: Thu, 23 Jun 2005 09:17:32 -0600 >You would use groupBy=3D"customerID,contactTypeID" in that case. > >On 6/23/05, Aaron Craven wrote: >> >> Wonderful! >> >> So, using the example below, I would simply add a groupBy to my resultMa= p for Customer (say groupBy=3D"customerID"), and one to my resultMap for Co= ntact (say groupBy=3D"contactID"), correct? >> >> One more question: what if Contact used a compound key? That is, suppose= the key for a Contact in the DB is [customerID, contactTypeID]. What woul= d I use for my groupBy setting on Contact? >> >> Thanks! >> >> ---------- Original Message ---------------------------------- >> From: Clinton Begin >> Reply-To: cbegin@ibatis.com >> Date: Wed, 22 Jun 2005 22:41:50 -0600 >> >> >There's no limit. You can go as wide or deep as you like. You can load = any >> >graph of practical limit (i.e. ridiculous graphs won't likely perform w= ell). >> >But certainly this is possible. The unit test actually uses a three tie= r >> >nesting. >> > >> >Cheers, >> >Clinton >> > >> > >> >On 6/22/05, Aaron Craven wrote: >> >> >> >> >> >> I cannot decide if I've missed something in the documentation, or if = I'm >> >> just plain old confused, but either way I need some help. With iBATIS= 2, I >> >> realize the N+1 selects problem has been solved by the addition of th= e >> >> groupBy property. However, I'm a bit confused as to how this would be= done >> >> with a deeper object graph. For example, suppose I have: >> >> >> >> - A Mapping that retrieves a number (M) of customers. Each customer h= as, >> >> in turn >> >> - A number (N) of contacts. Each contact, then has >> >> - A number (P) of addresses. >> >> >> >> Which would represent a=85 M:N:P relationship :) >> >> >> >> If I want this all in one mapping (something like CUSTOMER INNER JOIN= >> >> CONTACTS ON (=85) INNER JOIN ADDRESSES ON (=85)), would it be possibl= e, or is >> >> the depth of the join limited to one level of nesting? >> >> >> >> Thanks! >> >> >> >> >> >> >> >> >> >> ________________________________________________________________ >> >> Sent via the WebMail system at vickerscraven.net >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> >> ________________________________________________________________ >> Sent via the WebMail system at vickerscraven.net >> >> >> >> >> >> > ________________________________________________________________ Sent via the WebMail system at vickerscraven.net