openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schmidt <fakod...@googlemail.com>
Subject Re: ArgumentException: Failed to execute query
Date Fri, 11 Feb 2011 07:55:32 GMT
Seems that I forgot some JoinColumn annotations

 @Id
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumns({@JoinColumn(name = "obj_item_assoc_ix", nullable = false,
updatable = false),
            @JoinColumn(name = "obj_obj_item_id", nullable = false,
updatable = false),
            @JoinColumn(name = "subj_obj_item_id", nullable = false,
updatable = false)})
    protected ObjectItemAssociation objItemAssoc;

After years of JPA still learning the basics :)

Christopher

On Fri, Feb 11, 2011 at 8:09 AM, Christopher Schmidt <
fakod666@googlemail.com> wrote:

> Hi all, I have relatively complex entities (compound ids and id classes)
> but a really simple query:
>
> select o from ObjectItemAssociationStatus o  where o.ix = ?1 AND o.rptd.id= ?2
>
> Nevertheless I get the following exception (I can post the entities if it
> helps...)
>
> org.apache.openjpa.persistence.ArgumentException: Failed to execute query
> "select o from ObjectItemAssociationStatus o  where o.ix = ?1 AND
> o.rptd.id = ?2". Check the query syntax for correctness. See nested
> exception for details.
>  at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:870)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:792)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:288)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at
> org.jpaextension.manager.QueryWrapper.getResultList(QueryWrapper.scala:59)
> ~[jpaextension-0.0.2-SNAPSHOT.jar:na]
>  at
> org.jpaextension.manager.QueryHelper$DoWithQuery.withQuery(QueryHelper.scala:281)
> ~[jpaextension-0.0.2-SNAPSHOT.jar:na]
> . . .
> Caused by: java.lang.NullPointerException: null
> at
> org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java:696)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.getPrimaryKeyValue(HandlerFieldStrategy.java:315)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at
> org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.getPrimaryKeyValue(RelationFieldStrategy.java:958)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:187)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at
> org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:146)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.getPrimaryKeyValue(RelationFieldStrategy.java:965)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at
> org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:187)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:146)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1020)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at
> org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2344)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:274)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at
> org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at
> org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:36)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1246)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
> ~[openjpa-all-2.0.1.jar:2.0.1]
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:861)
> ~[openjpa-all-2.0.1.jar:2.0.1]
>  ... 35 common frames omitted
>
> Any idea?
>
> --
> Christopher
> twitter: @fakod
> blog: http://blog.fakod.eu
>
>


-- 
Christopher
twitter: @fakod
blog: http://blog.fakod.eu

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message