How to use Oracle hints in your query

You can use a ProjectionList as shown in this example:

ProjectionList proList = Projections.projectionList();

proList.add(Projections.sqlProjection("/*+INDEX_DESC(this_INDEX_NAME)*/ 1 as MYHINT",    new String[]{},    new Type[]{}));

//add properties from your class





Hibernate Criteria - example code

The Hibernate Criteria API is a powerful library, which is well adapted for implementing multi-criteria search functionalities where queries must be built on the fly. For example it can be used to return data in a web search form resulting in cleaner, clearer, more reliable, and more maintainable code.

Here are some examples of the Criteria Api.

Read more: Hibernate Criteria - example code

Follow us on Twitter