Re: EJBQLQuery and LEFT JOIN FETCH

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Mar 01 2008 - 04:44:02 EST

  • Next message: Razumovsky Andrey: "Expressions & objects state"

    Hi David,

    FETCH joins is one of the few features of EJBQL that are not yet
    supported. Working on it...

    Now, the error is of course totally confusing (what actually happens
    is Cayenne trying to treat the fetch join as a regular join). I just
    committed a small change to this code to simply throw
    UnsupportedOperationException on fetch joins. At least it makes it
    clear to the user what's going on.

    Thanks,
    Andrus

    On Feb 29, 2008, at 11:30 PM, David Marko wrote:

    > I have two tables (Issue and Reply) with 1:N relationship. I'm
    > trying to construct EJBQL query that would load issues and prefetch
    > replies. I tried this query: new EJBQLQuery("select a FROM Issue a
    > LEFT JOIN FETCH a.replyArray")
    >
    > .. but it throws error as below. Am I doing something wrong?
    >
    > David
    >
    > INFO - *** error.
    > java.lang.NullPointerException: Null entityId
    > at
    > org.apache.cayenne.access.jdbc.EJBQLTableId.<init>(EJBQLTableId.java:
    > 66)
    > at
    > org.apache.cayenne.access.jdbc.EJBQLTableId.<init>(EJBQLTableId.java:
    > 56)
    > at
    > org
    > .apache
    > .cayenne
    > .access
    > .jdbc.EJBQLFromTranslator.visitOuterJoin(EJBQLFromTranslator.java:91)
    > at
    > org
    > .apache
    > .cayenne
    > .access
    > .jdbc
    > .EJBQLFromTranslator.visitOuterFetchJoin(EJBQLFromTranslator.java:86)
    > at
    > org
    > .apache
    > .cayenne
    > .ejbql.parser.EJBQLOuterFetchJoin.visitNode(EJBQLOuterFetchJoin.java:
    > 35)
    > at org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:
    > 60)
    > at
    > org
    > .apache.cayenne.ejbql.parser.SimpleNode.visitChild(SimpleNode.java:84)
    > at
    > org.apache.cayenne.ejbql.parser.EJBQLFrom.visitChild(EJBQLFrom.java:
    > 40)
    > at org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:
    > 64)
    > at
    > org
    > .apache
    > .cayenne
    > .access
    > .jdbc.EJBQLSelectTranslator.visitFrom(EJBQLSelectTranslator.java:68)
    > at
    > org.apache.cayenne.ejbql.parser.EJBQLFrom.visitNode(EJBQLFrom.java:35)
    > at org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:
    > 60)
    > at
    > org
    > .apache.cayenne.ejbql.parser.SimpleNode.visitChild(SimpleNode.java:84)
    > at org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:
    > 64)
    > at org.apache.cayenne.access.jdbc.EJBQLAction
    > $1.visitSelect(EJBQLAction.java:73)
    > at
    > org
    > .apache.cayenne.ejbql.parser.EJBQLSelect.visitNode(EJBQLSelect.java:
    > 35)
    > at org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:
    > 60)
    > at
    > org
    > .apache
    > .cayenne.access.jdbc.EJBQLAction.performAction(EJBQLAction.java:67)
    > at
    > org
    > .apache
    > .cayenne
    > .access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:58)
    > at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:
    > 230)
    > at
    > org
    > .apache
    > .cayenne
    > .access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:442)
    > at org.apache.cayenne.access.DataDomainQueryAction.access
    > $000(DataDomainQueryAction.java:67)
    > at org.apache.cayenne.access.DataDomainQueryAction
    > $2.transform(DataDomainQueryAction.java:415)
    > at
    > org
    > .apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:
    > 847)
    > at
    > org
    > .apache
    > .cayenne
    > .access
    > .DataDomainQueryAction
    > .runQueryInTransaction(DataDomainQueryAction.java:412)
    > at
    > org
    > .apache
    > .cayenne
    > .access.DataDomainQueryAction.execute(DataDomainQueryAction.java:119)
    > at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:740)
    > at
    > org
    > .apache
    > .cayenne
    > .util
    > .ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:296)
    > at
    > org
    > .apache
    > .cayenne
    > .util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:
    > 84)
    > at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:
    > 1331)
    > at
    > org.apache.cayenne.access.DataContext.performQuery(DataContext.java:
    > 1320)
    > at com.tcldig.citi_projects.setup.EjbTest1.main(EjbTest1.java:28)
    >



    This archive was generated by hypermail 2.0.0 : Sat Mar 01 2008 - 04:44:33 EST