Interface Repository.LifecycleManagement<ID,E>
- Type Parameters:
ID- The type of identifier for entities in this repository.E- The type of entity this repository stores.
- All Superinterfaces:
DescribableComponent,Repository<ID,E>
- All Known Implementing Classes:
AccessSerializingRepository,EventSourcingRepository,InMemoryRepository,SimpleRepository
- Enclosing interface:
Repository<ID,E>
Specialization of the
Repository interface that must be implemented by all implementations of
the Repository. It exposes some methods that are required to perform lifecycle management operations that
are not typically required outside of repository implementation.
More specifically, these methods are meant for implementations of a Repository wrapping another to be
able to properly have lifecycle operations registered with downstream Repository implementations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.axonframework.modelling.repository.Repository
Repository.LifecycleManagement<ID,E> -
Method Summary
Modifier and TypeMethodDescriptionattach(ManagedEntity<ID, E> entity, ProcessingContext processingContext) Ensures that the givenentityhas its lifecycle managed in the givenprocessingContext.Methods inherited from interface org.axonframework.common.infra.DescribableComponent
describeToMethods inherited from interface org.axonframework.modelling.repository.Repository
entityType, idType, load, loadOrCreate, persist
-
Method Details
-
attach
ManagedEntity<ID,E> attach(@Nonnull ManagedEntity<ID, E> entity, @Nonnull ProcessingContext processingContext) Ensures that the givenentityhas its lifecycle managed in the givenprocessingContext. This ensures that when theprocessingContextcommits, any changes detected in the entity state are persisted in this repository's underlying storage, if present.If a managed entity for this identifier was already present in the
ProcessingContext, the new instance will replace it.Repositories may wrap entities. In that case, the returned instance may not be exactly the same (`==` comparison) as the instance provided. It is always recommended to use the returned instance.
- Parameters:
entity- The entity to have its lifecycle attached to the given processing context.processingContext- The processing context to link the lifecycle with.- Returns:
- The instance of the entity whose lifecycle is managed by this repository.
-