HHH-14024 Allow the creation of a different QueryPlan

This commit is contained in:
Davide D'Alto 2020-05-14 10:31:04 +01:00 committed by Steve Ebersole
parent e23dad19ca
commit 5968044118
1 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import java.util.concurrent.TimeUnit;
import org.hibernate.Filter; import org.hibernate.Filter;
import org.hibernate.MappingException; import org.hibernate.MappingException;
import org.hibernate.QueryException; import org.hibernate.QueryException;
import org.hibernate.Session;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification; import org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
@ -152,7 +153,7 @@ public class QueryPlanCache implements Serializable {
final long startTime = ( stats ) ? System.nanoTime() : 0L; final long startTime = ( stats ) ? System.nanoTime() : 0L;
LOG.tracev( "Unable to locate HQL query plan in cache; generating ({0})", queryString ); LOG.tracev( "Unable to locate HQL query plan in cache; generating ({0})", queryString );
value = new HQLQueryPlan( queryString, shallow, enabledFilters, factory ); value = createHQLQueryPlan( queryString, shallow, enabledFilters, factory );
if ( stats ) { if ( stats ) {
final long endTime = System.nanoTime(); final long endTime = System.nanoTime();
@ -172,6 +173,10 @@ public class QueryPlanCache implements Serializable {
return value; return value;
} }
protected HQLQueryPlan createHQLQueryPlan(String queryString, boolean shallow, Map<String, Filter> enabledFilters, SessionFactoryImplementor factory) {
return new HQLQueryPlan( queryString, shallow, enabledFilters, factory );
}
/** /**
* Get the query plan for the given collection HQL filter fragment, creating it and caching it if not already cached * Get the query plan for the given collection HQL filter fragment, creating it and caching it if not already cached
* *