Wow, what do you know. Looking at the history, I committed this in 2010 and forgot about it since :) IIRC this was an abandoned experiment that only works for returning the size during in-memory evaluation, but is otherwise ignored.
Glad Cayenne works for you otherwise! Andrus > On Jul 27, 2024, at 7:10 PM, Riccardo De Menna <deme...@tuorlo.net> wrote: > > Hi Andrus, > > Ok, I was fooled by the presence of this: > > >> public class Cayenne { >> >> /** >> * A special property denoting a size of the to-many collection, when >> * encountered at the end of the path</p> >> */ >> final static String PROPERTY_COLLECTION_SIZE = "@size"; > > In Cayenne’s source code here: > > https://github.com/apache/cayenne/blob/master/cayenne/src/main/java/org/apache/cayenne/Cayenne.java > > I sometimes miss EOF but I must say Cayenne is very gratifying. Working in a > modern IDE with a compact ORM is such a pleasure. I just need to find my way > on how things are done in this different world. I guess I’ll need to sort > in-memory. Or maybe put something on the db side. Thank you anyway. > > Riccardo > >> On 27 Jul 2024, at 21:14, Andrus Adamchik <aadamc...@gmail.com> wrote: >> >> No. Unlike EOF, "@size" is not a keyword with any meaning in Cayenne. >> >> Andrus >> >>> On Jul 27, 2024, at 2:38 PM, Riccardo De Menna <deme...@tuorlo.net> wrote: >>> >>> Can I use the @size keyword to sort a ToMany relationship in the backend >>> with >>> ObjectSelect.orderBy() ? >>> >>> I’m getting: >>> >>> java.lang.IllegalStateException: Unable to resolve path: compositions >>> (unknown '@size' component) >>> at >>> org.apache.cayenne.access.translator.select.ObjPathProcessor.processNormalAttribute(ObjPathProcessor.java:65) >>> ~[cayenne-server-4.2.jar:4.2] >>> at >>> org.apache.cayenne.access.translator.select.PathProcessor.process(PathProcessor.java:80) >>> ~[cayenne-server-4.2.jar:4.2] >>> at >>> org.apache.cayenne.access.translator.select.PathTranslator.lambda$translatePath$0(PathTranslator.java:48) >>> ~[cayenne-server-4.2.jar:4.2] >>> at >>> java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) >>> ~[na:na] >>> at >>> org.apache.cayenne.access.translator.select.PathTranslator.translatePath(PathTranslator.java:47) >>> ~[cayenne-server-4.2.jar:4.2] >>> at >>> org.apache.cayenne.access.translator.select.PathTranslator.translatePath(PathTranslator.java:52) >>> ~[cayenne-server-4.2.jar:4.2] >>> at >>> org.apache.cayenne.access.translator.select.QualifierTranslator.expressionNodeToSqlNode(QualifierTranslator.java:155) >>> ~[cayenne-server-4.2.jar:4.2] >>> at >>> org.apache.cayenne.access.translator.select.QualifierTranslator.startNode(QualifierTranslator.java:118) >>> ~[cayenne-server-4.2.jar:4.2] ……. >>> >>> >> >