The current documentation for the primitivesDefaultedForNullValue
flag in BeanPropertyRowMapper
makes it sound as if a BeanPropertyRowMapper
will actively set a primitive property to its default value or Java default value for such a primitive.
primitivesDefaultedForNullValue
: whether we're defaulting Java primitives in the case of mapping a null value
However, that is not actually the case. Rather, when primitivesDefaultedForNullValue
is set to true
and a NULL
value is retrieved from the ResultSet
for a primitive property, BeanPropertyRowMapper
logs a DEBUG message but otherwise does nothing, effectively ignoring the null value as opposed to "defaulting Java primitive".
If the primitive property's field is not explicitly initialized in the target class, the semantics are effectively the same as the current description; however, if the field is initialized with a custom value (not equal to the Java default value for a primitive of that type) -- or if the field is set by some other means (constructor, initialization block, etc.) -- the semantics are different from the current documentation since the modified value of the field will not be changed by the BeanPropertyRowMapper
.