Return-Path: Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: (qmail 62573 invoked from network); 6 Mar 2010 22:56:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Mar 2010 22:56:59 -0000 Received: (qmail 60387 invoked by uid 500); 6 Mar 2010 22:56:41 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 60358 invoked by uid 500); 6 Mar 2010 22:56:40 -0000 Mailing-List: contact dev-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list dev@cayenne.apache.org Received: (qmail 60350 invoked by uid 99); 6 Mar 2010 22:56:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Mar 2010 22:56:40 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 06 Mar 2010 22:56:38 +0000 Received: (qmail 27623 invoked from network); 6 Mar 2010 22:56:16 -0000 Received: from unknown (HELO ?IPv6:::1?) (127.0.0.1) by localhost with SMTP; 6 Mar 2010 22:56:16 -0000 Message-Id: From: Andrus Adamchik To: dev@cayenne.apache.org In-Reply-To: <4B8B0B2D-DD30-4686-9429-0D0158A27609@lindesay.co.nz> 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: Small Patch Date: Sat, 6 Mar 2010 17:56:17 -0500 References: <87316BB4-FAC1-4997-BDD8-3E755D991A33@objectstyle.org> <4B8B0B2D-DD30-4686-9429-0D0158A27609@lindesay.co.nz> X-Mailer: Apple Mail (2.936) On Mar 4, 2010, at 2:50 PM, Andrew Lindesay wrote: >> >> * This type of key-value coding creates property naming conflicts. >> EJBQL (see above) solves that by treating "size" as a function, not >> a property. If I am not mistaken WO would use something like @count >> to disambiguate naming, no? > > WebObjects does support "@count", but also "count". I guess "@size" > gets around the naming conflict of entity attributes so maybe that > is a better way to go. I think that would be a valid approach. Too > much functionality in such nested properties rather than controller > classes I think is not the way I would go, but this is so frequently > used that it is worth it. I guess "size(...)" function would work, > but I think I prefer "@size" on the end of the nested property and > to not create a system of using functions. +1. >> * To be consistent it would be nice to make it work in expressions >> across the board, i.e. not only for in-memory evaluation, but also >> for SelectQuery qualifiers > > That would be useful, but not really necessary straight away. > >> (EJBQL query supports that already, although with a different >> syntax: SIZE(author.books)). > > Sorry I don't know too much about EJBQL at this stage so I will have > to let you make a call on that. Yeah, I just wanted to outline what else needs to be done for this to become a first class citizen in Cayenne. One other thing I forgot is Expression.fromString(..) parsing. Anyways that can be added later. > Another thing which may help me implement this for my own use is if > the "readNestedProperty(..)" method were to iteratively be applied > to DataObjects rather than to eventually hit > Cayenne.readNestedProperty(..) and iterate in there. The entire > nested property is currently parsed at the start, but if it iterated > through the "readNestedProperty(..)" methods of the data objects > then just the first part of the nested property could be 'parsed > off'. The number of strings created from parsing the nested > property would only be 2x the number compared to the current > implementation. +1. o.a.c.Cayenne class can call DataObject's implementation internally (instead of doing it the other way), and if the root object is not a DataObject, call generic o.a.c.reflect.PropertyUtils.getProperty Andrus