I know its a repeated question but I am not able to find implementation of Oracle query hints - /*+PARALLEL(4)*/
in my Hibernate session
Below is the simplified version of my Spring boot service 1. DAOClass, 2. ResponseClass, 3. query.sql
Even though I have provided Query hints in query.sql, hibernate doesn't run the query faster. The same query runs faster in sqldeveloper. I don't know why Hibernate doesn't consider the hint /*+PARALLEL(4)*/
Contents of query.sql
SELECT /*+PARALLEL(4)*/
cust_id,
name
FROM cust_table
WHERE is_active='Y'
Contents of DAOClass
@Repository("DAOClass")
@Transactional(value = "JpaTxnManager", propagation = Propagation.REQUIRED)
public class DAOClass
{
EntityManager entityManager;
String queryString = readFromSqlFile(query.sql)
Query query = entityManager.createNativeQuery(queryString, ResponseClass.class)
List<ResponseClass> responseClassList = query.getResultist()
}
Contents of ResponseClass
@Entity
public class ResponseClass
{
@Id
@Column(name = "cust_id")
private String custId;
@Column(name = "name")
private String name;
//getter-setter methods
}
I read about Projections here but my implementation is totally different. I would like something thats easily implemented in my existing project.
I don't get any option of query.setComment()
like here
I have also checked mkyong implementation. But its different than the method that I have
How do I make /*+PARALLEL(4)*/
work in my Hibernate and spring code above?