hibernate/hibernate-orm · error · IllegalArgumentException
Null value not allowed for array-valued parameter ':{paramNa
Error message
Null value not allowed for array-valued parameter ':{paramName}' What it means
Error "Null value not allowed for array-valued parameter ':{paramName}'" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/internal/AbstractCommonQueryContract.java:1635
public CommonQueryContractImplementor setProperties(@Nonnull Object bean) {
final var beanClass = bean.getClass();
for ( String paramName : getParameterMetadata().getNamedParameterNames() ) {
try {
final var getter =
BuiltInPropertyAccessStrategies.BASIC.getStrategy()
.buildPropertyAccess( beanClass, paramName, true )
.getGetter();
final var returnType = getter.getReturnTypeClass();
final Object object = getter.get( bean );
if ( Collection.class.isAssignableFrom( returnType ) ) {
if ( object == null ) {
throw new IllegalArgumentException( "Null value not allowed for multi-valued parameter ':" + paramName + "'" );
}
setParameterList( paramName, (Collection<?>) object );
}
else if ( returnType.isArray() ) {
if ( object == null ) {
throw new IllegalArgumentException( "Null value not allowed for array-valued parameter ':" + paramName + "'" );
}
setParameterList( paramName, (Object[]) object );
}
else {
setParameter( paramName, object, determineType( paramName, returnType ) );
}
}
catch (PropertyNotFoundException pnfe) {
// ignore
}
}
return this;
}
protected <T> Type<T> determineType(String namedParam, Class<? extends T> retType) {
var type = getQueryParameterBindings().getBinding( namedParam ).getBindType();
if ( type == null ) {
type = getParameterMetadata().getQueryParameter( namedParam ).getHibernateType();View on GitHub (pinned to fad1729dce)
Solutions
- A null value was bound to an array-valued parameter. Pass a non-null array (empty if appropriate) for the parameter.
When it happens
Trigger: Null is bound to a collection/array-valued parameter: Null value not allowed for array-valued parameter ':<value>'
Common situations: Passing a null collection or array (or a collection containing null) to setParameterList()/an IN clause parameter.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/f424bc1f483aaae4.
Report an issue: GitHub.