Hi Andrus;

> * 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.

> * 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.

> (Also I hope you don't mind if I repost that on the dev list?)

That seems fine.  I have just subscribed to that list and replied back to the 
list.

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.

cheers.

...
>> Hello Andrus;
>> 
>> If approved, could I ask you to apply the attached patch to "Cayenne.java" 
>> in 3.1 trunk for me -- it will allow the use of a "size" property against 
>> collections in to-many relationships which, as you know, is commonly used in 
>> WebObjects key-paths...
>> 
>>      author.books.count
>> 
>> With this change a similar thing is possible against Cayenne data objects...
>> 
>>      author.books.size

___
Andrew Lindesay
www.lindesay.co.nz

Reply via email to