Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 59351 invoked from network); 1 Jun 2007 13:39:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jun 2007 13:39:02 -0000 Received: (qmail 28417 invoked by uid 500); 1 Jun 2007 13:39:05 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 28401 invoked by uid 500); 1 Jun 2007 13:39:05 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 28390 invoked by uid 99); 1 Jun 2007 13:39:05 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jun 2007 06:39:05 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [212.227.126.174] (HELO moutng.kundenserver.de) (212.227.126.174) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jun 2007 06:39:00 -0700 Received: from [217.7.104.66] (helo=ex1.GT.local) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2xA-1Hu7Kw0w42-0000st; Fri, 01 Jun 2007 15:38:38 +0200 Received: from m-ex1.GT.local ([192.168.100.12]) by ex1.GT.local with Microsoft SMTPSVC(5.0.2195.6713); Fri, 1 Jun 2007 15:39:33 +0200 Content-class: urn:content-classes:message Subject: AW: Joins and performance MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Date: Fri, 1 Jun 2007 15:39:32 +0200 Message-ID: <5EE5137D79A3CA45970354F512B3F3E3B4DFF8@m-ex1.gt.local> X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Joins and performance Thread-Index: AcXj6bk3fKUPuU0tEdq7qwBgCBBTdXAX898gAAHVLPA= From: "Vitzethum, Daniel" To: "Apache Torque Users List" X-OriginalArrivalTime: 01 Jun 2007 13:39:33.0760 (UTC) FILETIME=[49E89000:01C7A452] X-Provags-ID: V01U2FsdGVkX1/KWFa5MI1RZMC+OozRwwGp8W00T/cUk9/1nbP 3eV0PGgV/EHSi6jncaMcd0eZlGLNc6tPrq087ruMSJiNdgpW5w piTn7mtdPIAleKcEbjZFtEobnwuQU4s X-Virus-Checked: Checked by ClamAV on apache.org Hi Robert, > If I've 100 companies (which are schools) and 200 buildings, I will > executes 100 * 200 queries to get all the employees. be sure to avoid this... sounds like a killer ;-) > In low level SQL > this query can be combined in one query. Is there a way to handle > this within Torque? In Torque, you can use the Criteria.addJoin() method to link two tables. Using that feature, you cannot use the Peer.doSelect() method, but have to use Peer.doSelectVillageRecords(), which will return all columns of all joined tables in a village Record object, with no big difference to plain JDBC in handling. If you need or want Torque data objects, you have to extract them one by one from the result set. For a project of us, we wrote a helper class named JoinHelper that does this business for you AND returns an tree of Torque objects. In your case, it would return COMPANY objects that can be queried for their BUILDINGs, which again know their EMPLOYEEs. Please search the thread about two years ago in Torque archive and the discussion about. JoinHelper massively uses reflection, but is tested quite well and in production. If you have more detailled questions... you're welcome. Daniel --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org