Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 51313 invoked from network); 3 Mar 2007 22:37:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Mar 2007 22:37:06 -0000 Received: (qmail 26784 invoked by uid 500); 3 Mar 2007 22:37:14 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 26771 invoked by uid 500); 3 Mar 2007 22:37:14 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 26761 invoked by uid 99); 3 Mar 2007 22:37:14 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Mar 2007 14:37:14 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of marcin@ish.com.au designates 59.167.240.32 as permitted sender) Received: from [59.167.240.32] (HELO fish.ish.com.au) (59.167.240.32) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Mar 2007 14:37:03 -0800 Received: from [10.194.9.3] (helo=[10.194.9.3]) by fish.ish.com.au with esmtp (Exim 4.43) id 1HNcqD-0005Id-4M for user@cayenne.apache.org; Sun, 04 Mar 2007 09:36:45 +1100 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <8f985b960703030722h7e5cbefbodf69185b196eacac@mail.gmail.com> References: <4C725435-0C18-48B2-B4BA-A261428B53E3@ish.com.au> <8f985b960702271711h6e870c59h8606b5fb573d733@mail.gmail.com> <9A9ECAC2-AF65-48F7-B860-3630D9E0620A@ish.com.au> <8f985b960702280648s1f2a3f6co89ed94de3e48f32d@mail.gmail.com> <00F2BDBE-2FA4-4423-BE14-242EE23552DE@ish.com.au> <8f985b960703030722h7e5cbefbodf69185b196eacac@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <63632B6F-7411-44B9-A3A4-E3ECE085EE8F@ish.com.au> Content-Transfer-Encoding: 7bit From: Marcin Skladaniec Subject: Re: expression to find out null relationship Date: Sun, 4 Mar 2007 08:36:30 +1000 To: user@cayenne.apache.org X-Mailer: Apple Mail (2.752.2) X-Spam-Score: -1.4 (-) X-Spam-Report: -1.4 ALL_TRUSTED Passed through trusted hosts only via SMTP X-Virus-Checked: Checked by ClamAV on apache.org On 04/03/2007, at 1:22 AM, Mike Kienenberger wrote: > For your first case, be sure that $select also returns a field > named id. It does return id. The response contains the joined tables AppleTree and Apple, and $select has only the AppleTree fields listed: AppleTree.id, AppleTree.height etc. Still the object is not faulted and the exception is produced. > > For your second case, you have rooted your query on AppleTree, but you > are basing your query as if you were rooted on Apple. Provide a path > from AppleTree to Apple. > > SelectQuery sq = new SelectQuery(AppleTree.class, > ExpressionFactory.matchExp(AppleTree.APPLES + "." + Apple.COLOR, > "red") ); Yes, I'm doing that, I wrote it not correctly in the message only, as the real life example is far more complex than the Apple/AppleTree model. Anyway the Expression does not affect the result. Regards Marcin > > On 3/3/07, Marcin Skladaniec wrote: >> Hi >> I'm still struggling trying to fetch only AppleTrees with Apples >> which are red. >> >> Apple -AppleTree is a simple many-to-one relationship. I dont want to >> fault every appleTree and apple, I want to use either NamedQuery or >> Expression. >> When I attempt with NamedQuery like: >> > (AppleTree.id = Apple.treeId) where (Apple.color = 'red') ]]> >> I get a correct sql response, but cayenne fails to build up the >> entities out of it: >> org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT Jan 19 >> 2007 05:26:38] Remote error. URL - http://localhost:8181/angel- >> server- >> cayenne; CAUSE - [v.3.0-SNAPSHOT Jan 19 2007 05:26:38] [v.3.0- >> SNAPSHOT Jan 19 2007 05:26:38] Exception processing message >> org.apache.cayenne.remote.QueryMessage. Root cause: [v.3.0-SNAPSHOT >> Jan 19 2007 05:26:38] Null value for 'id'. >> >> when I try with Expression the expression is ignored and makes no >> difference, (is there an automatic join clause created ?): >> SelectQuery sq = new SelectQuery(AppleTree.class, >> ExpressionFactory.matchExp(Apple.COLOR, "red") ); >> >> Does someone have any hints ? >> Marcin >> >> >> >> On 01/03/2007, at 12:48 AM, Mike Kienenberger wrote: >> >> > You may be right. I vaguely recall now that this only works for >> > to-one relations. For to-many relations, I can't remember how I >> > handled this. >> > >> > >> > On 2/28/07, Marcin Skladaniec wrote: >> >> Hi >> >> Mike, the ExpressionFactory.noMatchExp(AppleTree.APPLE_PROPERTY, >> >> null) does not work. I tried. I recollect I used Expression which >> >> aimed other way around (from many to one, example : >> >> ExpressionFactory.noMatchExp(Apple.APPLE_TREE_PROPERTY, null) ). >> >> Marcin >> >> >> >> >> >> On 28/02/2007, at 11:11 AM, Mike Kienenberger wrote: >> >> >> >> > ExpressionFactory.noMatchExp(AppleTree.APPLE_PROPERTY, null) >> >> > >> >> > Be aware that you cannot safely combine this expression with >> other >> >> > expressions due to outer join issues, unless you're using the >> outer >> >> > join patch. I think there was another null-related fix >> mixed into >> >> > that patch. >> >> > >> >> > On 2/27/07, Marcin Skladaniec wrote: >> >> >> Hi >> >> >> >> >> >> I have a simple one-to-many relationship : AppleTree - >> Apple. I'm >> >> >> doing a query : >> >> >> new SelectQuery(AppleTree.class, expression) >> >> >> how should the expression look like to return the trees with >> >> apples ? >> >> >> expression = ExpressionFactory.noMatchExp(AppleTree.APPLES, >> null) >> >> >> does not seem to work, neither does >> >> >> expression = ExpressionFactory.noMatchExp("applesArray", null) >> >> >> >> >> >> Regards >> >> >> Marcin >> >> >> >> >> >> >> Marcin >> >> >> >> >> >> >> >> >> >> Marcin >> >> >> >> Marcin