title: How to use Oracle query hint in Hibernate
body: <p>I am trying to use Oracle hint in Hibernate to call force index, but didn't find any proper API in Hibernate 3.6.10.Final.</p>
  
  <p>I somehow tried with projections in Hibernate criteria: </p>
  
  <pre><code>proList.add(Projections.sqlProjection("/*+ INDEX_DESC(CONTACT_USER_FK_I) */", new String[]{}, new Type[]{}));
                  proList.add(Projections.property("objectId"));
                  criteria.setProjection(proList);
                  return criteria.list();
  </code></pre>
  
  <p>But I am getting the exception below:</p>
  
  <pre><code>    EXCEPTION
  Caused by: 8 SQL Error  (could not execute query; SQL [select /*+ INDEX_DESC(CONTACT_USER_FK_I) */, this_.CONTACT_ID as y0_ from R4GDEV01_MBW.CONTACT this_ w
  here this_.USER_ID=? and this_.ADDRESS_BOOK_ID in (?) and this_.DELETION_DATE is null order by lower(this_.FIRSTNAME) asc]; nested exception is org.hibernate
  .exception.SQLGrammarException: could not execute query)
          at com.fusionone.pml.dao.hibernate.AbstractDao.executeCallback(AbstractDao.java:391)
          at com.fusionone.pml.dao.hibernate.AbstractContactDao.searchContacts(AbstractContactDao.java:1019)
          at com.fusionone.nab.core.service.impl.MergeServiceImpl.getFilteredContactIds(MergeServiceImpl.java:154)
          ... 91 more
  </code></pre>
  
  <p>I found out that the projection is appending a <code>,</code> after query hint.</p>
  
  <p>Is there any other way to use Oracle query hint in Hibernate 3.6.10 criteria or in HQL?</p>
  
  <p>Thanks</p>