Why my Query Hints are not executed in Hibernate?

Solution Unverified - Updated -

Issue

While trying to include query hints in hibernate configuration an error message is logged when query is run:

server.log.18:org.hibernate.hql.ast.QuerySyntaxException: unexpected token: * near line 1, column 11 [select m /*+index (PK_COLUMN) */ from QueryHint q where q.id.date1 >= :initialDate and q.id.date2 <= :endDate and q.id.text  >= '' and q.number = :no]

This is the Query Configuration used:

<named-query name="queryWithQueryHints">
  <query>
    <![CDATA[
       select m /*+index (PK_COLUMN) */
       from QueryHint q
       where
          q.id.date1 >= :initialDate   and
          q.id.date2 <= :endDate       and
          q.id.text  >= ''             and
          q.number = :no
    ]]>
  </query>
</named-query>

Environment

  • JBoss Enterprise Application Platform all versions
  • Hibernate all versions

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