cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: EJBQLQuery and LEFT JOIN FETCH
Date Sat, 01 Mar 2008 09:44:02 GMT
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)
>


Mime
View raw message