DataClassRowMapper should not override Kotlin init properties#26569
DataClassRowMapper should not override Kotlin init properties#26569dennie170 wants to merge 1 commit intospring-projects:mainfrom
Conversation
Since Kotlin data classes are already constructed with values we
don't want to override all the properties later on again.
Properties modified in the init { } block in a class would be reverted
back to the value of the column again.
|
Hi team, I see nobody has replies to my issue since February. |
|
It turns out that Kotlin Thanks for the PR, in any case! |
|
Thanks for figuring it out and the clear explanation! Glad to see it's fixed now. |
Since Kotlin data classes are already constructed with values we don't want to override all the properties later on again.
Properties modified in the init { } block in a class would be reverted back to the value of the column again.
An example of this would be setting the default scale of a BigDecimal inside an init block. The init would be called and set the scale after constructing. However, after constructing the BeanPropertyRowMapper would override the BigDecimal again so the scale would be 0 again.
This commit fixes this issue for Kotlin data classes.