HHH-15408 QueryEngine to be more defensive with passed parameters

This commit is contained in:
Sanne Grinovero 2022-07-15 15:05:05 +01:00 committed by Sanne Grinovero
parent f7de8a8146
commit e6fdafc393
2 changed files with 8 additions and 5 deletions

View File

@ -9,6 +9,8 @@ package org.hibernate.community.dialect;
import java.util.Collections; import java.util.Collections;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.engine.query.internal.NativeQueryInterpreterStandardImpl;
import org.hibernate.engine.query.spi.NativeQueryInterpreter;
import org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl; import org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl;
import org.hibernate.orm.test.jpa.JpaComplianceStub; import org.hibernate.orm.test.jpa.JpaComplianceStub;
import org.hibernate.query.criteria.ValueHandlingMode; import org.hibernate.query.criteria.ValueHandlingMode;
@ -57,7 +59,7 @@ public class InformixDialectTestCase extends BaseUnitTestCase {
dialect.getPreferredSqlTypeCodeForBoolean(), dialect.getPreferredSqlTypeCodeForBoolean(),
false, false,
new NamedObjectRepositoryImpl( Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap() ), new NamedObjectRepositoryImpl( Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap() ),
null, NativeQueryInterpreterStandardImpl.NATIVE_QUERY_INTERPRETER,
dialect, dialect,
ssr ssr
); );

View File

@ -10,6 +10,7 @@ import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.hibernate.Incubating; import org.hibernate.Incubating;
@ -137,9 +138,9 @@ public class QueryEngine {
Dialect dialect, Dialect dialect,
SqmFunctionRegistry userDefinedRegistry, SqmFunctionRegistry userDefinedRegistry,
ServiceRegistry serviceRegistry) { ServiceRegistry serviceRegistry) {
this.namedObjectRepository = namedObjectRepository; this.namedObjectRepository = Objects.requireNonNull( namedObjectRepository );
this.sqmTranslatorFactory = sqmTranslatorFactory; this.sqmTranslatorFactory = sqmTranslatorFactory;
this.nativeQueryInterpreter = nativeQueryInterpreter; this.nativeQueryInterpreter = Objects.requireNonNull( nativeQueryInterpreter );
this.interpretationCache = interpretationCache; this.interpretationCache = interpretationCache;
this.hqlTranslator = hqlTranslator; this.hqlTranslator = hqlTranslator;
@ -202,9 +203,9 @@ public class QueryEngine {
NativeQueryInterpreter nativeQueryInterpreter, NativeQueryInterpreter nativeQueryInterpreter,
Dialect dialect, Dialect dialect,
ServiceRegistry serviceRegistry) { ServiceRegistry serviceRegistry) {
this.namedObjectRepository = namedObjectRepository; this.namedObjectRepository = Objects.requireNonNull( namedObjectRepository );
this.sqmTranslatorFactory = null; this.sqmTranslatorFactory = null;
this.nativeQueryInterpreter = nativeQueryInterpreter; this.nativeQueryInterpreter = Objects.requireNonNull( nativeQueryInterpreter );
this.sqmFunctionRegistry = new SqmFunctionRegistry(); this.sqmFunctionRegistry = new SqmFunctionRegistry();
this.typeConfiguration = jpaMetamodel.getTypeConfiguration(); this.typeConfiguration = jpaMetamodel.getTypeConfiguration();