HHH-15542 Cannot invoke 'org.hibernate.query.BindableType.getBindableJavaType()' because 'parameterType' is null

This commit is contained in:
Andrea Boriero 2022-09-26 16:33:12 +02:00 committed by Andrea Boriero
parent da1b1d6b75
commit cfc9b9c679
2 changed files with 18 additions and 13 deletions

View File

@ -462,23 +462,13 @@ public class ProcedureCallImpl<R>
public <T> ProcedureParameter<T> registerParameter(int position, Class<T> javaType, ParameterMode mode) {
final BindableType<T> parameterType = getSessionFactory().resolveParameterBindType( javaType );
final Class<T> expressibleJavaType;
if ( parameterType == null ) {
expressibleJavaType = null;
}
else {
final SqmExpressible<T> sqmExpressible = parameterType.resolveExpressible( getSessionFactory() );
assert sqmExpressible != null;
expressibleJavaType = sqmExpressible.getExpressibleJavaType().getJavaTypeClass();
}
final ProcedureParameterImpl<T> procedureParameter = new ProcedureParameterImpl<>(
position,
mode,
expressibleJavaType,
getExpressibleJavaType( parameterType ),
parameterType
);
registerParameter( procedureParameter );
return procedureParameter;
@ -518,7 +508,7 @@ public class ProcedureCallImpl<R>
final ProcedureParameterImpl<T> parameter = new ProcedureParameterImpl<>(
name,
mode,
parameterType.getBindableJavaType(),
getExpressibleJavaType( parameterType ),
parameterType
);
@ -527,6 +517,18 @@ public class ProcedureCallImpl<R>
return parameter;
}
private <T> Class<T> getExpressibleJavaType(BindableType<T> parameterType) {
if ( parameterType == null ) {
return null;
}
else {
final SqmExpressible<T> sqmExpressible = parameterType.resolveExpressible( getSessionFactory() );
assert sqmExpressible != null;
return sqmExpressible.getExpressibleJavaType().getJavaTypeClass();
}
}
@Override
public <T> ProcedureParameterImplementor<T> registerParameter(
String name,

View File

@ -187,6 +187,9 @@ public class ProcedureParameterImpl<T> extends AbstractQueryParameter<T> impleme
};
}
}
else if ( typeToUse == null ) {
throw new IllegalArgumentException( "Cannot determine the bindable type for procedure parameter: " + name );
}
else {
throw new NotYetImplementedFor6Exception( getClass() );
}