We're updating the issue view to help you get more done. 

Query.setProperties(Map) silently ignores null values provided in the Map

Description

In a Query.setProperties(Map) method was introduced to set query named parameters using a Map. Unfortunately this method silently ignores null values contained in the Map.

See org.hibernate.internal.AbstractQueryImpl.setProperties(Map), here it is checked whether the value is not null. Only if it is not null it is added as parameter.

However the Javadoc clearly states that there are Map implementations which contain null values, a return value of null for the java.util.Map.get(Object) method does not necessarily indicate that the key is not contained in the Map. To check whether a key is contained in the Map, the containsKey(Object) method should be used.

If it is not possible to fix the Query.setProperties(Map) method, the Javadoc regarding this method should at least include a hint that null values are never bound to the named parameters using this method. It might be difficult to bind the null values, because the original type of these values is not known anymore in this method.

Environment

4.1.5.SP1

Status

Assignee

Andrea Boriero

Reporter

Matthias Otterbach

Fix versions

Labels

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.0.6
4.1.5.SP1

Priority

Major