Skip to content

Clarify semantics of primitivesDefaultedForNullValue in BeanPropertyRowMapper #29923

@sbrannen

Description

@sbrannen

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.

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)status: backportedAn issue that has been backported to maintenance branchestype: documentationA documentation task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions