|
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:
@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 {
org.hibernate.Query hqlQuery = internalGetSession().createQuery( jpaqlString );
resultClassChecking( resultClass, hqlQuery );
return new QueryImpl<T>( hqlQuery, this );
}
catch ( RuntimeException e ) {
throw convert( e );
}
}
|