"org.hibernate.QueryException: Legacy-style query parameters (`?`) are no longer supported; use JPA-style ordinal parameters (e.g., `?1`) instead" in JBoss EAP 7.2.0.

Solution Verified - Updated -

Issue

  • Executing a query using non-JPA compliant query parameters (?) as in the example below:

    ... entityManager.createQuery("SELECT e FROM Employee e WHERE e.name = ?", Employee.class);
    
  • The query fails at runtime with a QueryException like the one below:

    ... org.hibernate.QueryException: Legacy-style query parameters (`?`) are no longer supported; use JPA-style ordinal parameters (e.g., `?1`) instead : 
        at org.hibernate.QueryException.generateQueryException(QueryException.java:120) [hibernate-core-5.3.7.Final-redhat-00001.jar:5.3.7.Final-redhat-00001]
        at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:103) [hibernate-core-5.3.7.Final-redhat-00001.jar:5.3.7.Final-redhat-00001]
        at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:219) [hibernate-core-5.3.7.Final-redhat-00001.jar:5.3.7.Final-redhat-00001]
        at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:143) [hibernate-core-5.3.7.Final-redhat-00001.jar:5.3.7.Final-redhat-00001]
        ...
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7.2 and later

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content