3

I am new to Hibernate and using the following versions of Hibernate:

hibernate-core-4.3.11.Final
hibernate-jpa-2.1-api-1.0.0.Final

I am trying to set a timeout on a query. The Query class of Hibernate has setTimeout API which is used to set the timeout, however, it doesn't work. Found some posts which talk about using Query.setHint, but this API is not available in the above version.

Can someone guide how can the query timeout be set for above versions?

This is what I have tried so far:

session = //open hibernate session; 
Query query = session.createSQLQuery(sql).setCacheable(false); 
query.setTimeout(60);
Tschallacka
  • 27,901
  • 14
  • 88
  • 133

0 Answers0