OpenJPA
  1. OpenJPA
  2. OPENJPA-920

LIKE does not accept expression as second parameter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      JDK 1.6

      Description

      I have simple data object :

      @Id
      String Id ;

      @Basic
      @Column(name="my_value", nullable=false, length=36)
      String value ;

      OpenJPA give my the following exception when execute the query:

      SELECT t from MySimpleObject t WHERE ?1 like concat(t.value,'%')

      Exception in thread "main" <openjpa-1.2.0-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Encountered "? 1 like concat" at character 38, but expected: ["(", "*", "+", "-", "/", ":", "<", "<=", "<>", "=", ">", ">=", "?", "BETWEEN", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "EXISTS", "IS", "LIKE", "MEMBER", "NOT", <BOOLEAN_LITERAL>, <DECIMAL_LITERAL>, <IDENTIFIER>, <INTEGER_LITERAL>, <STRING_LITERAL>].
      at org.apache.openjpa.kernel.jpql.JPQL.generateParseException(JPQL.java:9501)
      at org.apache.openjpa.kernel.jpql.JPQL.jj_consume_token(JPQL.java:9378)
      at org.apache.openjpa.kernel.jpql.JPQL.conditional_primary(JPQL.java:1947)
      at org.apache.openjpa.kernel.jpql.JPQL.conditional_factor(JPQL.java:1925)
      at org.apache.openjpa.kernel.jpql.JPQL.conditional_term(JPQL.java:1791)
      at org.apache.openjpa.kernel.jpql.JPQL.conditional_expression(JPQL.java:1753)
      at org.apache.openjpa.kernel.jpql.JPQL.where_clause(JPQL.java:1556)
      at org.apache.openjpa.kernel.jpql.JPQL.select_statement(JPQL.java:91)
      at org.apache.openjpa.kernel.jpql.JPQL.parseQuery(JPQL.java:63)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(JPQLExpressionBuilder.java:1740)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.<init>(JPQLExpressionBuilder.java:1727)
      at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:48)
      at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:149)
      at org.apache.openjpa.datacache.QueryCacheStoreQuery.newCompilation(QueryCacheStoreQuery.java:241)
      at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:657)
      at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
      at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
      at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
      at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1492)
      at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
      at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:243)
      at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:293)
      at Tester.simpleJpql(Tester.java:87)
      at Tester.main(Tester.java:180)

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Georgi Naplatanov
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development