Skip to content

Clarify semantics of primitivesDefaultedForNullValue in BeanPropertyRowMapper #29923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sbrannen opened this issue Feb 3, 2023 · 0 comments
Closed
Assignees
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

Comments

@sbrannen
Copy link
Member

sbrannen commented Feb 3, 2023

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.

@sbrannen sbrannen added in: data Issues in data modules (jdbc, orm, oxm, tx) type: documentation A documentation task labels Feb 3, 2023
@sbrannen sbrannen added this to the 6.0.5 milestone Feb 3, 2023
@sbrannen sbrannen self-assigned this Feb 3, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.3.x labels Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant