Issue/1137 duplicate constructor calls for setting version #1196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This moves around existing behavior to populate the value of
@Version
annotated fields before execution of theAggregateChange
instead of after. This is based on the idea that these values are determined by the module and not dependent onAggregateChange
execution, unlike the values of@Id
annotated fields. The value ofpreviousVersion
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.