How can I explicitly tell Hibernate to use or not to use SQL index?
Also does Hibernate create SQL index if it finds it would be efficient use of resources?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest way to force a full table scan is to drop the index. Why maintaining an index you don’t want to use anyway.
Hibernate is an ORM tool, it’s the underlaying database that decides how to execute queries – whether or not to use an index. So if you want to keep the index, and you think the query planer picks the index when it shouldn’t, then maybe you could twist the sql query so that it results in a full table scan, or use a database specific sql syntax –
SELECT FULL()...in Oracle,enable_indexscan(false)in Postgresql, etc, (if such thing exists for your db).No.