Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 68220 invoked from network); 19 Oct 2007 14:17:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Oct 2007 14:17:45 -0000 Received: (qmail 81785 invoked by uid 500); 19 Oct 2007 14:16:40 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 81775 invoked by uid 500); 19 Oct 2007 14:16:40 -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 81760 invoked by uid 99); 19 Oct 2007 14:16:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Oct 2007 07:16:40 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of clinton.begin@gmail.com designates 209.85.198.188 as permitted sender) Received: from [209.85.198.188] (HELO rv-out-0910.google.com) (209.85.198.188) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Oct 2007 14:16:40 +0000 Received: by rv-out-0910.google.com with SMTP id c27so424594rvf for ; Fri, 19 Oct 2007 07:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:references:in-reply-to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language:message-id; bh=PrLqJMGDhiAphKjtyT5OCrfpyfadBt6nJQJf6CR3JsU=; b=IPuEXQQiNqU0Vdz/asOpVhiNUSPni4vkc4dwmWD8oa8KIJt47TXVthgfixVZ4Ay0mVrm8vyiAtwrAuxmUh5EOUrVes8HwLOf/2KeGSRBSm8dPhfNnTfz1ekNmVlkD5Edyl4ybZBfAabN7/lPDKDSNqidQKRWpsNrLrXuJKZ7vdM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:references:in-reply-to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language:message-id; b=r1jdRJMcnqWYXXKoogW4DRmUWFGAIlvxPX6JXn1Dweb52Drq3wtljOIKtgUbeHoSisO3Ty6d2/NrKpZRYbUZEenUdShCtBEnB+pxsbCAUChTKKvVdzqiKtBfvyLg9sba4H+jxQKHnMtdtPlW1fIr0emP4h3wT4Zp4vPlAjG0tEE= Received: by 10.141.162.16 with SMTP id p16mr989833rvo.1192803333776; Fri, 19 Oct 2007 07:15:33 -0700 (PDT) Received: from DARKSTAR ( [24.66.195.100]) by mx.google.com with ESMTPS id k34sm3673440rvb.2007.10.19.07.15.30 (version=SSLv3 cipher=OTHER); Fri, 19 Oct 2007 07:15:31 -0700 (PDT) From: "Clinton Begin" To: References: In-Reply-To: Subject: RE: PLEASE HELP - self-joins to obtain a tree structure Date: Fri, 19 Oct 2007 08:15:26 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcgSIEjRCqe7v46GQN2Yuq89UsZdwAAOY7xQ Content-Language: en-ca Message-ID: <4718bc03.22578c0a.249c.ffff8385@mx.google.com> X-Virus-Checked: Checked by ClamAV on apache.org Your JDBC driver may only allow a certain number of result sets open at a time (per connection). If your tree is a fixed depth, you can see if you can try to configure it such that you have enough (in ms sql server, make sure your select mode is "cursor"). If your tree is arbitrarily sized or simply very deep, then this whole approach may be very inefficient and you'd be better off trying something else. You could try doing an actual SQL self join, or just load the flat structure into an array of objects and use a more efficient tree mapping algorithm to link it all up. It's not a super easy or clean thing to do...but my first question to you would be...do you actually need the whole tree? And does it need to be a tree? Regards, Clinton -----Original Message----- From: Mark McKenzie [mailto:mark.mckenzie@pcmsgroup.com] Sent: October-19-07 1:15 AM To: user-java@ibatis.apache.org Subject: PLEASE HELP - self-joins to obtain a tree structure Hi, I am trying to use the following IBatis SQL map to retrieve a single object (ProductGroup) which will contain a parent object of the same type. The parent object itself could also potentially have a parent object ?.. and so on and so on until we reach the top of the tree: Unfortunately this does not appear to work when I use it to retrieve a product group with more than 1 parent object. Here is a partial stack trace of the problem I get: