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 RepositoryName
Custom and RepositoryName
Impl 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