T
- The type of aggregate stored in this repository. Must implement EventSourcedAggregateRoot
.public class HybridJpaRepository<T extends AggregateRoot> extends GenericJpaRepository<T>
Constructor and Description |
---|
HybridJpaRepository(EntityManagerProvider entityManagerProvider,
Class<T> aggregateType)
Initializes a Hybrid Repository that stored entities of the given
aggregateType and the locking
mechanism provided by the backend storage. |
HybridJpaRepository(EntityManagerProvider entityManagerProvider,
Class<T> aggregateType,
LockManager lockManager)
Initializes a Hybrid Repository that stored entities of the given
aggregateType and a locking
mechanism based on the given lockManager . |
HybridJpaRepository(EntityManagerProvider entityManagerProvider,
Class<T> aggregateType,
String aggregateTypeIdentifier)
Initializes a Hybrid Repository that stored entities of the given
aggregateType without locking. |
HybridJpaRepository(EntityManagerProvider entityManagerProvider,
Class<T> aggregateType,
String aggregateTypeIdentifier,
LockManager lockManager)
Initializes a Hybrid Repository that stored entities of the given
aggregateType and a locking
mechanism based on the given lockManager . |
Modifier and Type | Method and Description |
---|---|
protected void |
doDeleteWithLock(T aggregate)
Perform the actual deleting of the aggregate.
|
protected void |
doSaveWithLock(T aggregate)
Perform the actual saving of the aggregate.
|
protected String |
getTypeIdentifier()
Returns the type identifier to use when appending events in the event store.
|
void |
setEventStore(EventStore eventStore)
The event store to which events are appended.
|
doLoad, setForceFlushOnSave
add, doDelete, doSave, load
getAggregateType, load, postDelete, postSave, setEventBus, validateOnLoad
public HybridJpaRepository(EntityManagerProvider entityManagerProvider, Class<T> aggregateType)
aggregateType
and the locking
mechanism provided by the backend storage.entityManagerProvider
- The EntityManagerProvider providing the EntityManager instance for this repositoryaggregateType
- The type of aggregate stored in this repository.public HybridJpaRepository(EntityManagerProvider entityManagerProvider, Class<T> aggregateType, String aggregateTypeIdentifier)
aggregateType
without locking.
The events are appended to the event store under the given aggregateTypeIdentifier
.entityManagerProvider
- The EntityManagerProvider providing the EntityManager instance for this
repositoryaggregateType
- The type of aggregate stored in this repository.aggregateTypeIdentifier
- The type identifier to store events withpublic HybridJpaRepository(EntityManagerProvider entityManagerProvider, Class<T> aggregateType, LockManager lockManager)
aggregateType
and a locking
mechanism based on the given lockManager
.entityManagerProvider
- The EntityManagerProvider providing the EntityManager instance for this repositoryaggregateType
- The type of aggregate stored in this repository.lockManager
- The locking strategy to use when loading and storing aggregatespublic HybridJpaRepository(EntityManagerProvider entityManagerProvider, Class<T> aggregateType, String aggregateTypeIdentifier, LockManager lockManager)
aggregateType
and a locking
mechanism based on the given lockManager
.entityManagerProvider
- The EntityManagerProvider providing the EntityManager instance for this
repositoryaggregateType
- The type of aggregate stored in this repository.aggregateTypeIdentifier
- The type identifier to store events withlockManager
- The locking strategy to use when loading and storing aggregatesprotected void doDeleteWithLock(T aggregate)
LockingRepository
doDeleteWithLock
in class GenericJpaRepository<T extends AggregateRoot>
aggregate
- the aggregate to deleteprotected void doSaveWithLock(T aggregate)
LockingRepository
doSaveWithLock
in class GenericJpaRepository<T extends AggregateRoot>
aggregate
- the aggregate to storeprotected String getTypeIdentifier()
public void setEventStore(EventStore eventStore)
eventStore
- The event store where events should be appendedCopyright © 2010-2014. All Rights Reserved.