Latest code snapshot breaks EJBQLQuery

From: Dave Dombrosky (dombr..mail.com)
Date: Fri Dec 05 2008 - 02:52:34 EST

  • Next message: Pierre Lavignotte: "Re: Problem with sequences in PostgreSQL"

    A query that runs fine for me (with a strange workaround) in r721197,
    is failing in the latest code from cayenne trunk (r723425 as of this
    writing). I am running it as an EJBQLQuery using
    DataContext.performQuery(Query arg).

    The query looks something like the following "SELECT COUNT(a),
    a.relationship, a.relationship.attr, a.relationship.attr FROM ObjName
    a GROUP BY a.relationship, a.relationship.attr, a.relationship.attr".
    With the older cayenne library, I had to get "a.relationship.attr" a
    second time in the select and group lists, because cayenne was not
    returning the final result column to me. This was a decent workaround
    for a while, but now this query won't even execute with the new
    cayenne library!

    With the latest cayenne code, I am seeing the following error:

    Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
            at org.apache.cayenne.access.jdbc.ScalarRowReader.<init>(ScalarRowReader.java:40)
            at org.apache.cayenne.access.jdbc.JDBCResultIterator.createRowReader(JDBCResultIterator.java:123)
            at org.apache.cayenne.access.jdbc.JDBCResultIterator.<init>(JDBCResultIterator.java:83)
            at org.apache.cayenne.access.jdbc.SQLTemplateAction.processSelectResult(SQLTemplateAction.java:223)
            at org.apache.cayenne.access.jdbc.SQLTemplateAction.execute(SQLTemplateAction.java:171)
            at org.apache.cayenne.access.jdbc.SQLTemplateAction.performAction(SQLTemplateAction.java:127)
            at org.apache.cayenne.access.jdbc.EJBQLAction.performAction(EJBQLAction.java:101)
            at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:57)
            at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:236)

    I tried removing some parts of the query, and it seems like I can run
    the query if I remove the "a.relationship" part of it, but i need this
    to get the PK of the referenced object. Is there some way to
    reference the DB Path of this instead of my current method? It
    doesn't seem like db path expressions are supported for EJBQLQuery
    yet...

    -Dave



    This archive was generated by hypermail 2.0.0 : Fri Dec 05 2008 - 02:53:17 EST