Return-Path: Delivered-To: apmail-incubator-cayenne-user-archive@locus.apache.org Received: (qmail 64940 invoked from network); 19 Jun 2006 16:33:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Jun 2006 16:33:45 -0000 Received: (qmail 59688 invoked by uid 500); 19 Jun 2006 16:33:44 -0000 Delivered-To: apmail-incubator-cayenne-user-archive@incubator.apache.org Received: (qmail 59665 invoked by uid 500); 19 Jun 2006 16:33:43 -0000 Mailing-List: contact cayenne-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cayenne-user@incubator.apache.org Delivered-To: mailing list cayenne-user@incubator.apache.org Received: (qmail 59653 invoked by uid 99); 19 Jun 2006 16:33:43 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2006 09:33:43 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of gcjcu-cayenne-user-moved1@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2006 09:33:41 -0700 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FsMgA-0006Lz-EF for cayenne-user@incubator.apache.org; Mon, 19 Jun 2006 18:32:46 +0200 Received: from mail2.hayesinc.com ([207.10.43.2]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 19 Jun 2006 18:32:46 +0200 Received: from aperez by mail2.hayesinc.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 19 Jun 2006 18:32:46 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: cayenne-user@incubator.apache.org From: Arturo Perez Subject: Re: Problem traversing relationships - need hint Date: Mon, 19 Jun 2006 16:32:01 +0000 (UTC) Lines: 56 Message-ID: References: <18B17D80-389A-4018-89A2-B0AEB7C419F8@objectstyle.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 207.10.43.2 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4) Sender: news X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Andrus Adamchik objectstyle.org> writes: > > > On Jun 19, 2006, at 5:13 PM, Arturo Perez wrote: > > > Iterator i = articleCategory.getArticles().iterator(); > > while (i.hasNext()) { > > ArticleCategoryLink acl = (ArticleCategoryLink)i.next(); > > ArticleMeta am = acl.getLatestArticle(); > > Article a = am.getArticle(); > > } > > > > The article is null but if I run an Expression I get what I expect: > > > > Expression exp = > > ExpressionFactory.matchExp("activeArticle.categories.category", > > category); > > exp = exp.andExp( > > Expression.fromString("latestArticle.article > > activeArticle.article")); > > The last expression looks strange (I am surprised it compiles). What > SQL is generated for the query? > > Andrus > > It looks like the equal sign went away. It should be "latestArticle.article = activeArticle.article" That last expression is intended to limit results to the current articles. Everything has backissues that should be ignored for the above. The SQL is a 4-way join: 2006-06-19 12:25:21,249 [http-8316-Processor24] WARN org.objectstyle.cayenne.access.QueryLogger- SELECT DISTINCT t0.ARTICLE_ID, t0.ARTICLE_META_ID FROM ARTICLE t0, ARTICLE_META t1, ARTICLE_CATEGORY_LINK t2, ARTICLE_META t3 WHERE t0.ARTICLE_ID = t1.ACTIVE_ARTICLE_ID AND t1.ARTICLE_META_ID = t2.ARTICLE_META_ID AND t0.ARTICLE_META_ID = t3.ARTICLE_META_ID AND ((t2.CATEGORY_ID = ?) AND (t1.ACTIVE_ARTICLE_ID = t1.ACTIVE_ARTICLE_ID)) [bind: 1042] 2006-06-19 12:25:23,608 [http-8316-Processor24] WARN org.objectstyle.cayenne.access.QueryLogger- === returned 91 rows. - took 2359 ms. I suppose I should change the above to a matchInExp to cut down on the join but I'm more concerned about the null. Although, looking at that SQL, the last AND clause seems incorrect. -arturo