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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.