You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Heath Thomann (JIRA)" <ji...@apache.org> on 2016/03/04 18:59:40 UTC

[jira] [Resolved] (OPENJPA-1307) Problems with parameterized JPQLs and EmbeddedId

     [ https://issues.apache.org/jira/browse/OPENJPA-1307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Heath Thomann resolved OPENJPA-1307.
------------------------------------
    Resolution: Duplicate

HI!  This issue is the same as OPENJPA-2631.  

Thanks,

Heath

> Problems with parameterized JPQLs and EmbeddedId
> ------------------------------------------------
>
>                 Key: OPENJPA-1307
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1307
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 1.2.1
>            Reporter: M M
>
> OpenJPA cannot do a SELECT with parameterized JPQL queries and EmbeddedId.
> E. g., following configuration doesn't work:
> There a two entities: EntA and EntB. Both have a composite primary key (EntAPK and EntBPK) that is used as an embedded id. I want to execute following query:
> SELECT a FROM EntA a WHERE a.entB=:entB
> Needlays to say, the parameter is an object of the entity EntB.
> While executing the getResultList method I get following exception:
> Caused by: java.lang.ClassCastException: com.example.EntBPK cannot be cast to [Ljava.lang.Object;
>         at org.apache.openjpa.jdbc.kernel.exps.Param.appendTo(Param.java:126)
>         at org.apache.openjpa.jdbc.kernel.exps.EqualExpression.appendTo(EqualExpression.java:73)
>         at org.apache.openjpa.jdbc.kernel.exps.CompareEqualExpression.appendTo(CompareEqualExpression.java:98)
>         at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.buildWhere(SelectConstructor.java:240)
>         at org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate(SelectConstructor.java:81)
>         at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects(JDBCStoreQuery.java:339)
>         at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:179)
>         at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:681)
>         at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:988)
>         at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:848)
>         ... 44 more



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)