diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractQueryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractQueryImpl.java index d41cc4b496..6f32d3d494 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractQueryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractQueryImpl.java @@ -900,20 +900,24 @@ public abstract class AbstractQueryImpl implements Query { String namedParam = params[i]; final Object object = map.get( namedParam ); if ( object == null ) { - continue; - } - Class retType = object.getClass(); - if ( Collection.class.isAssignableFrom( retType ) ) { - setParameterList( namedParam, (Collection) object ); - } - else if ( retType.isArray() ) { - setParameterList( namedParam, (Object[]) object ); + Type type = parameterMetadata.getNamedParameterDescriptor( namedParam ).getExpectedType(); + if ( type == null ) { + type = StandardBasicTypes.SERIALIZABLE; + } + setParameter( namedParam, object, type ); } else { - setParameter( namedParam, object, determineType( namedParam, retType ) ); + Class retType = object.getClass(); + if ( Collection.class.isAssignableFrom( retType ) ) { + setParameterList( namedParam, (Collection) object ); + } + else if ( retType.isArray() ) { + setParameterList( namedParam, (Object[]) object ); + } + else { + setParameter( namedParam, object, determineType( namedParam, retType ) ); + } } - - } return this; }