spring-projects / spring-projects/spring-data-commons
Provide entity context for repository fragments [DATACMNS-1134]
@odrotbohm is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 838
- Forks
- 730
- PR merge metrics
- No merged PRs in 30d
Description
Mark Paluch opened DATACMNS-1134 and commented
TL;DR:
Provide an entity context for repository fragments (Inject RepositoryMetadata or a smaller interface).
Explanation
Composable repositories allow a composition model that is much more decoupled from the original repository than the previous single custom implementation model. Custom implementations are no longer required to follow RepositoryNameCustom and RepositoryNameImpl but can have names decoupled from the repository itself.
This degree of freedom allows reuse of implementations across multiple repositories:
interface UserRepository implements Repository<User, String>, SoftDeletingRepository<User>{}
interface PersonRepository implements Repository<Person, String>, SoftDeletingRepository<Person>{}
From the example above, SoftDeletingRepository is a fragment which is used in multiple repositories and depending on its functionality, the fragment would require an entity context to perform its actions.
The difficulty is, that fragment instances are passed into a repository factory, and the entity context is created at a later time when the repository is instantiated. Fragments could be reused across multiple factory beans creating a shared mutable state.
No further details from DATACMNS-1134
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.