This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using "FORCE INDEX" clause in HQL

 
Renato Veneroso
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello people,

Does anybody know whether is possible to include the "FORCE INDEX" clause in an HQL sentence? Due to what seems to be a MySQL bug the best index of a table has not been used and this is causing performance loss. The problem can be fixed in pure SQL using the clause "FORCE INDEX" but in HQL it cannot be used (at least not explicitly).

Is there a way I can re-write my HQL so that it forces the use of specific index?

Thanks in advance.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could just use a SQL query, since Hibernate supports querying with SQL. You would be making your Hibernate code platform specific if you did this though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic