What is the preferred way to get the PK (or any unmapped column) when
using an EJBQL query?
If I have a path expression (a.b) that references a table, then the
query runs to completion. The only problem here is that the PK column
doesn't get the sc* alias, so it doesn't get added to the returned
Object[]. If I try the same path but with ".id" (a.b.id) to reference
the PK column, then i get the following error:
java.lang.IllegalStateException: Invalid path component: id
Stack trace
* org.apache.cayenne.access.jdbc.EJBQLPathTranslator.processLastPathComponent(EJBQLPathTranslator.java:187)
* org.apache.cayenne.access.jdbc.EJBQLPathTranslator.visitPath(EJBQLPathTranslator.java:74)
* org.apache.cayenne.ejbql.parser.EJBQLPath.visitChild(EJBQLPath.java:72)
* org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:64)
* org.apache.cayenne.access.jdbc.EJBQLSelectColumnsTranslator.visitPath(EJBQLSelectColumnsTranslator.java:105)
* org.apache.cayenne.ejbql.parser.EJBQLPath.visitNode(EJBQLPath.java:67)
* org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:60)
* org.apache.cayenne.ejbql.parser.SimpleNode.visitChild(SimpleNode.java:84)
* org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:64)
Then if I try prefixing the path expression with "db" (db:a.b.id) I
get the following error:
java.lang.IllegalStateException: Invalid path component: id
Stack trace
* org.apache.cayenne.access.jdbc.EJBQLPathTranslator.processLastPathComponent(EJBQLPathTranslator.java:187)
* org.apache.cayenne.access.jdbc.EJBQLPathTranslator.visitPath(EJBQLPathTranslator.java:74)
* org.apache.cayenne.ejbql.parser.EJBQLPath.visitChild(EJBQLPath.java:72)
* org.apache.cayenne.ejbql.parser.EJBQLDbPath.visitChild(EJBQLDbPath.java:31)
* org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:64)
* org.apache.cayenne.access.jdbc.EJBQLSelectColumnsTranslator.visitPath(EJBQLSelectColumnsTranslator.java:105)
* org.apache.cayenne.ejbql.parser.EJBQLPath.visitChild(EJBQLPath.java:72)
* org.apache.cayenne.ejbql.parser.EJBQLDbPath.visitChild(EJBQLDbPath.java:31)
* org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:64)
It appears to be using a db-path parser in this last case, but I still
can't access the column. What am I doing wrong?
-Dave
This archive was generated by hypermail 2.0.0 : Thu Oct 02 2008 - 16:44:35 EDT