Return-Path: X-Original-To: apmail-db-torque-dev-archive@www.apache.org Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4E69B47E5 for ; Tue, 21 Jun 2011 20:48:12 +0000 (UTC) Received: (qmail 42110 invoked by uid 500); 21 Jun 2011 20:48:12 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 42083 invoked by uid 500); 21 Jun 2011 20:48:12 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 42075 invoked by uid 99); 21 Jun 2011 20:48:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jun 2011 20:48:12 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of minfrin@sharp.fm designates 72.32.122.20 as permitted sender) Received: from [72.32.122.20] (HELO chandler.sharp.fm) (72.32.122.20) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jun 2011 20:48:03 +0000 Received: from chandler.sharp.fm (localhost [127.0.0.1]) by chandler.sharp.fm (Postfix) with ESMTP id 171F05C802B for ; Tue, 21 Jun 2011 15:47:42 -0500 (CDT) Received: from [10.0.0.251] (87-194-125-19.bethere.co.uk [87.194.125.19]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: minfrin@sharp.fm) by chandler.sharp.fm (Postfix) with ESMTP id 42DF55C8029 for ; Tue, 21 Jun 2011 15:47:40 -0500 (CDT) Message-Id: <71E1219E-EAA7-46AB-99D2-3B4895547404@sharp.fm> From: Graham Leggett To: "Apache Torque Developers List" In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: template changes to add filler methods Date: Tue, 21 Jun 2011 22:47:33 +0200 References: X-Mailer: Apple Mail (2.936) X-Virus-Scanned: ClamAV using ClamSMTP X-Virus-Checked: Checked by ClamAV on apache.org On 19 Jun 2011, at 1:57 PM, Thomas Fox wrote: > I have locally implemented filler methods for associated objects and > would > like to commit the changes. > The filler methods efficiently read related objects. E.g. for the > author > and book tables in the tutorial, the generated methods are > AuthorPeer.fillBook(Collection) and BookPeer.fillAuthors > (Collection), and they fill the collBooks field of each author > in the > passed list and the aAuthor field of each book in the list. The > generated > filler methods collect the relevant local keys from the objects in the > passed list and retrieve the associated objects for chunks (of > configurable > size) of the keys. A sample query would be SELECT * FROM BOOK WHERE > AUTHOR_ID in (${authorId1},${authorId2}, ...). This is a very fast > method > of loading related objects for a list of objects (fewer query than > lazy > loading, less duplicate data transferred than joins). > The methods will return lists of the retrieved objects (e.g. > AuthorPeer.fillBook(Collection) returns a list of authors) so > cascaded filling is possible. > The generated methods also work for composite foreign keys and for > foreign > keys which do not reference the primary key of the referenced table. > To re-use the exising selectByPrimaryKeys() methods, I have added > methods > to the object which return the foreign key for accociated objects as > ObjectKey. E.g. the Book object has the method ObjectKey > getForeignKeyForAuthor(). > The generation of the filler methods can be switched off by a > generation > option. Currently the default is that the filler methods are > generated. We have needed exactly this for ages, this would be a huge help to us. Regards, Graham -- --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org