HHH-17492 Allow parameter inferred mapping for same java types

This commit is contained in:
Marco Belladelli 2023-12-06 12:25:40 +01:00 committed by Christian Beikov
parent 9c18319c1c
commit 01b7cf6288

View File

@ -5949,7 +5949,8 @@ else if ( paramType instanceof MappingModelExpressible<?> ) {
final JdbcMapping paramJdbcMapping = paramModelType.getSingleJdbcMapping(); final JdbcMapping paramJdbcMapping = paramModelType.getSingleJdbcMapping();
final JdbcMapping inferredJdbcMapping = inferredValueMapping.getSingleJdbcMapping(); final JdbcMapping inferredJdbcMapping = inferredValueMapping.getSingleJdbcMapping();
// Only use the inferred mapping as parameter type when the JavaType accepts values of the bind type // Only use the inferred mapping as parameter type when the JavaType accepts values of the bind type
if ( inferredJdbcMapping.getMappedJavaType().isWider( paramJdbcMapping.getMappedJavaType() ) if ( ( inferredJdbcMapping.getMappedJavaType() == paramJdbcMapping.getMappedJavaType()
|| inferredJdbcMapping.getMappedJavaType().isWider( paramJdbcMapping.getMappedJavaType() ) )
// and the bind type is not explicit or the bind type has the same JDBC type // and the bind type is not explicit or the bind type has the same JDBC type
&& ( !bindingTypeExplicit || canUseInferredType( paramJdbcMapping, inferredJdbcMapping ) ) ) { && ( !bindingTypeExplicit || canUseInferredType( paramJdbcMapping, inferredJdbcMapping ) ) ) {
return resolveInferredValueMappingForParameter( inferredValueMapping ); return resolveInferredValueMappingForParameter( inferredValueMapping );