-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: USE INDEX (index_name) option in Criteria queries
PostPosted: Mon Aug 22, 2005 12:28 pm 
Newbie

Joined: Tue Mar 09, 2004 12:01 am
Posts: 9
Hibernate version: 3.1

Name and version of the database you are using: MySQL 4.1 (but valid on any MySQL and probably other DB too)

I love the Criteria API, it solves my current problems quite well. But I believe it could be made even more flexible.

I currently had performances problems in a range of SQL queries, and the way to solve it was to tell MySQL to use a particular index for this type of queries (the problem occurs in some multiple join with order by queries) via the
Code:
SELECT FROM table_name USE INDEX (index_name) ...


With Hibernate 3.1, I did not find a way to add this bit of SQL via the Criteria API, when I want to. I believe this could be possible if I patched hibernate for my purpose (modifying org.hibernate.sql.Select and AbstractEntityJoinWalker a bit), but I obviously would prefer a less hacky solution.

Writing SQL queries in the mapping file is not a good solution since I have lots of those queries with slightly different Expressions/Projections. (which is one of the reasons why I am using the Criteria API).

Is there already a way to do what I want that I did not see? If not, would this be seriously considered in a near future release?


Top
 Profile  
 
 Post subject: I posted a patch for it in JIRA
PostPosted: Wed Aug 24, 2005 5:18 am 
Newbie

Joined: Tue Mar 09, 2004 12:01 am
Posts: 9
I made a patch to support this, this is in JIRA under HHH-902


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.