クエリヒントを Hibernate で実行できない理由

Solution Unverified - Updated -

Issue

Hibernate 設定にクエリーヒントが含まれる場合は、クエリーを実行するとエラーメッセージがログに記録されます。

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]

これは、使用されるクエリー設定となります。

<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 (すべてのバージョン)
  • Hibernate (すべてのバージョン)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.