Return-Path: Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 87487 invoked from network); 2 Jul 2003 17:28:24 -0000 Received: from mucho.2alpha.com (209.189.206.8) by daedalus.apache.org with SMTP; 2 Jul 2003 17:28:24 -0000 Received: (root@localhost) by mucho.2alpha.com (SMI-8.6/SMI-SVR4) id KAA20297; Wed, 2 Jul 2003 10:28:27 -0700 Received: from host190.purplebear.com(209.189.211.190) by mucho.2alpha.com(209.189.206.8) via smtpd (2.02) id q-20030702172826-20296-001; Wed 2 Jul 2003 10:28:26 -0700 Date: Wed, 2 Jul 2003 10:28:25 -0700 X-Habeas-Swe-6: email in exchange for a license for this Habeas Subject: Re: Retrieving Joined Data Mime-Version: 1.0 (Apple Message framework v552) Content-Transfer-Encoding: 7bit From: John Dietz In-Reply-To: <77BC7FD3-AB8A-11D7-B5A0-000393BBD6A8@purplebear.com> To: "Turbine Torque Users List" X-Habeas-Swe-1: winter into spring X-Habeas-Swe-2: brightly anticipated X-Habeas-Swe-3: like Habeas SWE (tm) X-Habeas-Swe-4: Copyright 2002 Habeas (tm) X-Habeas-Swe-5: Sender Warranted Email (SWE) (tm). The sender of this Content-Type: text/plain; charset=US-ASCII; format=flowed X-Habeas-Swe-7: warrant mark warrants that this is a Habeas Compliant X-Habeas-Swe-8: Message (HCM) and not spam. Please report use of this X-Habeas-Swe-9: mark in spam to . Message-Id: <960C194A-ACB2-11D7-A671-000393BBD6A8@purplebear.com> X-Mailer: Apple Mail (2.552) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Okay, I thought I could get the joined data by calling something like ItemPeer.doSelectJoinCategory(), but the doSelectJoin methods appear to be defined as Protected, so I can't call them from my other packages, although this appears to be the documented way to do Joins and get the resulting data. Given that, I don't see at all how to actually do a Join and get the resulting data. The Torque documentation has several examples of creating the Join criteria without any examples of actually retrieving the data, and I haven't found any clear answer in the listserv archive either. So my simple question is: How can you do a join of tables and get the full results? Thanks, John Dietz On Monday, June 30, 2003, at 11:08 PM, John Dietz wrote: > I'm having a hard time seeing the value if the Criteria addJoin method > given that it doesn't do quite what I expected. Let me explain by > example: > > Let's say I have two tables, Category and Item, with a FK relationship > where each Category has several Items (reference to the Category it > Item). > Here's what I was hoping for, if I do this: > Criteria crit = new Criteria(); > crit.addJoin(CategoryPeer.CATEGORY_ID, ItemPeer.CATEGORY_ID); > List categories = CategoryPeer.doSelect(crit); > > What I was hoping for was a List of all the Categories, prefilled with > the Items available using Category.getItems(); > What in fact happens is that the list of Categories includes duplicate > Categories, one for each item (like the resultset you would expect > from a straight SQL Join), then a call to Category.getItems() run's > another query to get all of the Items. > > I realize I could do a ItemPeer.doSelectJoinCategory(), which would > get me a list of all the Items with the Category prefilled, but I > would really like to get a list of Categories with the getItems() > prefilled (instead of running another query to get the list for each > Category). > > So if I don't get that with the addJoin(), then is there some other > way to get that result? > > John Dietz > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org >