We're updating the issue view to help you get more done. 

javax.persistence.query.timeout hint is not fully supported

Description

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 @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 ); } }

Environment

None

Status

Assignee

Unassigned

Reporter

Steve Dodd

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.3.10

Priority

Major