-
Notifications
You must be signed in to change notification settings - Fork 358
Constructor is accessed twice when persisting Java 16 records #1137
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
Labels
type: bug
A general bug
Comments
This is a general issue in Spring Data JDBC where the version number is being set twice:
|
@mp911de Additional note, during this operation properties are accessed twice each, except Id which is accessed 3 times. |
Additional property access is required to create new instances of an object. |
lseeker
pushed a commit
to lseeker/spring-data-jdbc
that referenced
this issue
Apr 6, 2022
…DbActions to simplify execution context. This change incorporates one test from spring-projects#1150 Original pull request spring-projects#1196 Closes spring-projects#1137
lseeker
pushed a commit
to lseeker/spring-data-jdbc
that referenced
this issue
Apr 6, 2022
This change extracts entity modifying behaviour into separate methods, so it doesn't appear as an unexpected side effect of the creation of aggregate changes. Also some formatting. Original pull request spring-projects#1196 See spring-projects#1137
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When new Java record is persisted using repository's
save
method, it's constructor is called twice with the same parameters.One should be enough to set id and/or version.
Minimal reproducible example: hajdamak/spring-data-jdbc-record-access
Requires Maven and JDK17.
Call
mvn spring-boot:run
.Relevant output:
The text was updated successfully, but these errors were encountered: