HHH-15497 Count query when counting polymorphic subclasses by type fails when run twice

This commit is contained in:
Andrea Boriero 2022-09-12 17:05:57 +02:00 committed by Andrea Boriero
parent 7af0642f5b
commit a9c55587f2
2 changed files with 6 additions and 3 deletions

View File

@ -51,9 +51,7 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
protected QueryParameterBindingImpl(
QueryParameter<T> queryParameter,
SessionFactoryImplementor sessionFactory) {
this.queryParameter = queryParameter;
this.sessionFactory = sessionFactory;
this.bindType = queryParameter.getHibernateType();
this( queryParameter, sessionFactory, queryParameter.getHibernateType() );
}
/**

View File

@ -204,6 +204,11 @@ public class SqmUtil {
final Map<SqmParameter<?>, List<List<JdbcParameter>>> jdbcParamMap = jdbcParamXref.get( queryParam );
for ( SqmParameter<?> sqmParameter : sqmParameters ) {
final MappingModelExpressible resolvedMappingModelType = mappingModelResolutionAccess
.getResolvedMappingModelType( sqmParameter );
if ( resolvedMappingModelType != null ) {
domainParamBinding.setType( resolvedMappingModelType );
}
final Bindable parameterType = determineParameterType(
domainParamBinding,
queryParam,