|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.repository.AbstractRepository<T>
org.axonframework.repository.LockingRepository<T>
org.axonframework.repository.GenericJpaRepository<T>
T - The type of aggregate the repository provides access topublic class GenericJpaRepository<T extends AbstractJpaAggregateRoot>
Generic repository implementation that stores JPA annotated aggregates. These aggregates must implement AbstractJpaAggregateRoot.
| Constructor Summary | |
|---|---|
GenericJpaRepository(Class<T> aggregateType)
Initialize a repository for storing aggregates of the given aggregateType. |
|
GenericJpaRepository(Class<T> aggregateType,
LockingStrategy lockingStrategy)
Initialize a repository for storing aggregates of the given aggregateType with an additional
lockingStrategy. |
|
| Method Summary | |
|---|---|
protected T |
doLoad(AggregateIdentifier aggregateIdentifier,
Long expectedVersion)
Perform the actual loading of an aggregate. |
protected void |
doSaveWithLock(T aggregate)
Perform the actual saving of the aggregate. |
void |
setEntityManager(javax.persistence.EntityManager entityManager)
Sets the EntityManager this repository should use to access the underlying storage. |
void |
setForceFlushOnSave(boolean forceFlushOnSave)
Indicates whether the EntityManager's state should be flushed each time an aggregate is saved. |
| Methods inherited from class org.axonframework.repository.LockingRepository |
|---|
doSave, load |
| Methods inherited from class org.axonframework.repository.AbstractRepository |
|---|
add, load, setEventBus, validateOnLoad |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GenericJpaRepository(Class<T> aggregateType)
aggregateType. No additional locking
will be used.
aggregateType - the aggregate type this repository manages
public GenericJpaRepository(Class<T> aggregateType,
LockingStrategy lockingStrategy)
aggregateType with an additional
lockingStrategy.
aggregateType - the aggregate type this repository manageslockingStrategy - the additional locking strategy for this repository| Method Detail |
|---|
protected void doSaveWithLock(T aggregate)
LockingRepository
doSaveWithLock in class LockingRepository<T extends AbstractJpaAggregateRoot>aggregate - the aggregate to store
protected T doLoad(AggregateIdentifier aggregateIdentifier,
Long expectedVersion)
LockingRepository
doLoad in class LockingRepository<T extends AbstractJpaAggregateRoot>aggregateIdentifier - the identifier of the aggregate to loadexpectedVersion - The expected version of the aggregate
public void setEntityManager(javax.persistence.EntityManager entityManager)
entityManager - the EntityManager providing access to the underlying storage.public void setForceFlushOnSave(boolean forceFlushOnSave)
true.
Flushing the EntityManager will force JPA to send state changes to the database. Any key violations and failing
optimistic locks will be identified in an early stage.
forceFlushOnSave - whether or not to flush the EntityManager after each save. Defaults to
true.EntityManager.flush()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||