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 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.orm.test.jpa.JpaComplianceStub;
import org.hibernate.query.criteria.ValueHandlingMode;
@ -57,7 +59,7 @@ public class InformixDialectTestCase extends BaseUnitTestCase {
dialect.getPreferredSqlTypeCodeForBoolean(),
false,
new NamedObjectRepositoryImpl( Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap() ),
null,
NativeQueryInterpreterStandardImpl.NATIVE_QUERY_INTERPRETER,
dialect,
ssr
);

View File

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