Re: Complicated SQL queries
Christian Gonzalez <[email protected]> Wed, 7 Feb 2024 10:25:34 -0700
| Newsgroups | gmane.comp.java.cayenne.user |
|---|---|
| Message-ID | <CAHsd-2C7OtfSwe2uNU_+K8mHS0avmoGLqqTCOJ+NZC8r8n+f1g@mail.gmail.com> |
One last question, I was trying to update another query using the same method of identifying the wanted columns when trying to fetch from a different ObjectEntity than the one from the ObjectSelect. The issue seems to be that the column I'm selecting is the pk column of another ObjectEntity? The query I'm doing looks something like this. ObjectSelect.query(ObjectEntityA.class).columns(ObjEntityA.PROP_FOR_OBJECT_B.dot(ObjEntityB.PROP_FOR_OBJECT_C.dot(ObjEntityC.PROP_FOR_OBJECT_D.dot(ObjEntityD.ENTITY_D_PK_PROP).count()))).where(ObjEntityA.PROP_FOR_OBJECT_E.dot(ObjEntityE.PROP).eq(someValue)).select(context). However this returns an error that says "Can't translate dbid path 'dbEntityB.dbEntityDPKAttribute', no such pk ''. I know cayenne usually doesn't include pk property's however we use cgen to generate the java classes and have the flag createPKProperties set to true so the properties get generated. Could this be a part of the issue or am I doing the query wrong?