You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Constructor is accessed twice when persisting Java 16 records #1137
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.
changed the title [-]Constructor is accessed twice when persisting Java 16 rerods[/-][+]Constructor is accessed twice when persisting Java 16 records[/+]on Jan 20, 2022
Activity
[-]Constructor is accessed twice when persisting Java 16 rerods[/-][+]Constructor is accessed twice when persisting Java 16 records[/+]mp911de commentedon Jan 21, 2022
This is a general issue in Spring Data JDBC where the version number is being set twice:
AggregateChangeExecutor->execute->executeInsertRoot->RelationalEntityVersionUtils.setVersionNumberOnEntityAggregateChangeExecutor->executionContext.populateRootVersionIfNecessary(root)hajdak commentedon Jan 21, 2022
@mp911de Additional note, during this operation properties are accessed twice each, except Id which is accessed 3 times.
mp911de commentedon Jan 24, 2022
Additional property access is required to create new instances of an object.
Polishing.
Determine and set the value for entity @Version before conversion to …
Polishing.