|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.repository.AbstractRepository<T> org.axonframework.repository.LockingRepository<T> org.axonframework.repository.GenericJpaRepository<T> org.axonframework.eventsourcing.HybridJpaRepository<T>
T
- The type of aggregate stored in this repository. Must implement EventSourcedAggregateRoot
.public class HybridJpaRepository<T extends AggregateRoot>
Repository that stores both a (JPA based) relational model of the current state of an aggregate and the events produced by that aggregate. When an aggregate is loaded, only the relational model is used to reconstruct the aggregate state.
As events are not used for reconstructing the aggregate state, there is no need for snapshots or upcasters. In some scenario's that could be a sensible choice.
Constructor Summary | |
---|---|
HybridJpaRepository(javax.persistence.EntityManager entityManager,
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(javax.persistence.EntityManager entityManager,
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 . |
|
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 . |
Method Summary | |
---|---|
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. |
Methods inherited from class org.axonframework.repository.GenericJpaRepository |
---|
doLoad, setForceFlushOnSave |
Methods inherited from class org.axonframework.repository.LockingRepository |
---|
add, doDelete, doSave, load |
Methods inherited from class org.axonframework.repository.AbstractRepository |
---|
getAggregateType, load, postDelete, postSave, setEventBus, validateOnLoad |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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(javax.persistence.EntityManager entityManager, Class<T> aggregateType, LockManager lockManager)
aggregateType
and a locking
mechanism based on the given lockManager
.
entityManager
- 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 aggregatespublic HybridJpaRepository(javax.persistence.EntityManager entityManager, Class<T> aggregateType, String aggregateTypeIdentifier, LockManager lockManager)
aggregateType
and a locking
mechanism based on the given lockManager
.
entityManager
- 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 aggregatesMethod Detail |
---|
protected 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 appended
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |