HHH-7705 - Fix Query.setProperties(Map) silently ignores null values provided in the Map

This commit is contained in:
Andrea Boriero 2016-02-01 18:24:46 +00:00
parent 5711c3ce6c
commit 7dec9f83e2
1 changed files with 15 additions and 11 deletions

View File

@ -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;
}