Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1307

Problems with parameterized JPQLs and EmbeddedId

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.2.1
    • None
    • jdbc, kernel
    • None

    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

          Activity

            People

              Unassigned Unassigned
              mamull M M
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: