HHH-15716 ClassCastException in QueryParameterBindingsImpl.generateQueryKeyMemento

This commit is contained in:
Andrea Boriero 2022-11-18 02:34:06 +01:00 committed by Andrea Boriero
parent 03f1ce9c49
commit 4ca9c2bb3b
1 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import org.hibernate.QueryParameterException;
import org.hibernate.cache.spi.QueryKey;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.MappingModelExpressible;
import org.hibernate.query.QueryParameter;
import org.hibernate.query.spi.ParameterMetadataImplementor;
@ -214,8 +215,12 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings {
}
}
if ( binding.getType() != null ) {
return binding.getType();
final MappingModelExpressible<?> type = binding.getType();
if ( type != null ) {
if ( type instanceof EntityMappingType ) {
return ( (EntityMappingType) type ).getIdentifierMapping();
}
return type;
}
final TypeConfiguration typeConfiguration = session.getFactory().getTypeConfiguration();