Skip to content

fix(persistence)!: keep versioned MyBatis updates on the loaded aggregate - #314

Merged
youngledo merged 2 commits into
mainfrom
codex/mybatis-modify-tracking
Nov 16, 2026
Merged

youngledo merged 2 commits into
mainfrom
codex/mybatis-modify-tracking

Conversation

@youngledo

Copy link
Copy Markdown
Contributor

Summary

  • Make doAdd, doModify, and doRemove final on MybatisPlusAggregateRepository.
  • Dependent-row synchronization moves to onRootInserted, onRootUpdated, and onRootRemoved, which run only after the root write accepts the aggregate instance loaded or added in the current persistence context.
  • Update the English and Chinese MyBatis-Plus implementation docs.

Migration

Subclasses that override doAdd, doModify, or doRemove no longer compile. Move child-row work into the completion hooks. doFindById can still delegate to loadAggregate.

Validation

./mvnw -pl jfoundry-core/jfoundry-infrastructure/jfoundry-persistence-mybatis-plus,jfoundry-runtime/jfoundry-spring/jfoundry-spring-integration-tests -am -Dtest=MybatisPlusAggregateRepositoryApiTest,MybatisPlusAggregateRepositoryIntegrationTest,MybatisPlusAggregateRepositoryOptimisticLockIntegrationTest -Dsurefire.failIfNoSpecifiedTests=false test

Make doAdd, doModify, and doRemove final so a subclass cannot replace a
versioned root write with a primary-key update. Dependent rows synchronize
from the completion hooks after that root write is accepted.
Multi-table synchronization now uses the root completion hooks. Subclasses
can no longer replace doAdd, doModify, or doRemove.
@youngledo
youngledo enabled auto-merge (squash) November 16, 2026 14:49
@youngledo
youngledo merged commit f3d6773 into main Nov 16, 2026
22 checks passed
@youngledo
youngledo deleted the codex/mybatis-modify-tracking branch November 16, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant