Skip to content

Issue/1137 duplicate constructor calls for setting version #1196

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
wants to merge 5 commits into from

Conversation

ctailor2
Copy link
Contributor

@ctailor2 ctailor2 commented Mar 17, 2022

This moves around existing behavior to populate the value of @Version annotated fields before execution of the AggregateChange instead of after. This is based on the idea that these values are determined by the module and not dependent on AggregateChange execution, unlike the values of @Id annotated fields. The value of previousVersion is determined at the same time, such that it can be used for update and delete actions on entities with @Version.

I originally did this refactor in the context of exploring a possible design for #537 where AggregateChange represents the change plan via DbAction for multiple entities and JdbcAggregateChangeExecutionContext is capable of being used for multiple roots. I later discovered that it is perhaps more relevant to #1137 so I isolated the work on its own branch to present for consideration here.

Related to #1150.
Closes #1137.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 17, 2022
@ctailor2 ctailor2 marked this pull request as ready for review March 18, 2022 14:17
@ctailor2 ctailor2 requested a review from schauder March 18, 2022 14:17
schauder pushed a commit that referenced this pull request Mar 22, 2022
…DbActions to simplify execution context.

This change incorporates one test from #1150

Original pull request #1196
Closes #1137
schauder added a commit that referenced this pull request Mar 22, 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 #1196
See #1137
@schauder
Copy link
Contributor

Thanks. That's polished and merged.

@schauder schauder closed this Mar 22, 2022
@schauder schauder added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 22, 2022
lseeker pushed a commit to lseeker/spring-data-jdbc that referenced this pull request 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 pull request 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
@schauder schauder deleted the issue/1137-dup-constructor-calls-for-version branch July 5, 2022 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constructor is accessed twice when persisting Java 16 records
3 participants