javax.persistence.query.timeout hint is not fully supported
Description
Activity
Show:

Brett Meyer August 26, 2015 at 7:12 PM
Please start these types of questions on the user forums. Open JIRAs only after a concise issue is identified and a test case is available. Thanks!
Rejected
Details
Details
Assignee
Unassigned
UnassignedReporter

Components
Affects versions
Priority
Created July 16, 2015 at 3:55 PM
Updated August 26, 2015 at 7:12 PM
Resolved August 26, 2015 at 7:12 PM
From what I understand, this hint is supposed to be propagated from the EntityManager to all queries and ORM operations executed by that EntityManager.
At present, the hint is only propagated to queries created using createQuery(String), and not to queries created using any other create*Query method, nor to any ORM operations, like find() and so on.
It's clear in the code why this is so. The createQuery(String) method calls applyProperties(Query) to apply hints to the query, whereas createQuery(String, Class) does not:
org.hibernate.jpa.spi.AbstractEntityManagerImpl.java
@Override public Query createQuery(String jpaqlString) { checkOpen(); try { return applyProperties( new QueryImpl<Object>( internalGetSession().createQuery( jpaqlString ), this ) ); } catch ( RuntimeException e ) { throw convert( e ); } } protected abstract void checkOpen(); @Override public <T> TypedQuery<T> createQuery(String jpaqlString, Class<T> resultClass) { checkOpen(); try { // do the translation org.hibernate.Query hqlQuery = internalGetSession().createQuery( jpaqlString ); resultClassChecking( resultClass, hqlQuery ); // finally, build/return the query instance return new QueryImpl<T>( hqlQuery, this ); } catch ( RuntimeException e ) { throw convert( e ); } }