Clarify semantics of primitivesDefaultedForNullValue
in BeanPropertyRowMapper
#29923
Labels
in: data
Issues in data modules (jdbc, orm, oxm, tx)
status: backported
An issue that has been backported to maintenance branches
type: documentation
A documentation task
Milestone
The current documentation for the
primitivesDefaultedForNullValue
flag inBeanPropertyRowMapper
makes it sound as if aBeanPropertyRowMapper
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 valueHowever, that is not actually the case. Rather, when
primitivesDefaultedForNullValue
is set totrue
and aNULL
value is retrieved from theResultSet
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
.The text was updated successfully, but these errors were encountered: