In HHH-2037 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.
|