Description
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
Attachments
Issue Links
- is duplicated by
-
OPENJPA-2631 ClassCastException occurs when an equals comparison query is executed on an entity with an @EmbeddedId that contains more than one field.
- Closed