|
||||||||||
| 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 AggregateRoot>
Generic repository implementation that stores JPA annotated aggregates. These aggregates must implement AggregateRoot and have the proper JPA Annotations.
| Constructor Summary | |
|---|---|
GenericJpaRepository(javax.persistence.EntityManager entityManager,
Class<T> aggregateType)
Initialize a repository for storing aggregates of the given aggregateType. |
|
GenericJpaRepository(javax.persistence.EntityManager entityManager,
Class<T> aggregateType,
LockManager lockManager)
Initialize a repository for storing aggregates of the given aggregateType with an additional
lockManager. |
|
GenericJpaRepository(EntityManagerProvider entityManagerProvider,
Class<T> aggregateType)
Initialize a repository for storing aggregates of the given aggregateType. |
|
GenericJpaRepository(EntityManagerProvider entityManagerProvider,
Class<T> aggregateType,
LockManager lockManager)
Initialize a repository for storing aggregates of the given aggregateType with an additional
lockManager. |
|
| Method Summary | |
|---|---|
protected void |
doDeleteWithLock(T aggregate)
Perform the actual deleting of the aggregate. |
protected T |
doLoad(Object aggregateIdentifier,
Long expectedVersion)
Perform the actual loading of an aggregate. |
protected void |
doSaveWithLock(T aggregate)
Perform the actual saving of the aggregate. |
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 |
|---|
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 GenericJpaRepository(EntityManagerProvider entityManagerProvider,
Class<T> aggregateType)
aggregateType. No additional locking
will be used.
entityManagerProvider - The EntityManagerProvider providing the EntityManager instance for this repositoryaggregateType - the aggregate type this repository manages
public GenericJpaRepository(javax.persistence.EntityManager entityManager,
Class<T> aggregateType)
aggregateType. No additional locking
will be used.
entityManager - The EntityManager instance for this repositoryaggregateType - the aggregate type this repository manages
public GenericJpaRepository(EntityManagerProvider entityManagerProvider,
Class<T> aggregateType,
LockManager lockManager)
aggregateType with an additional
lockManager.
entityManagerProvider - The EntityManagerProvider providing the EntityManager instance for this repositoryaggregateType - the aggregate type this repository manageslockManager - the additional locking strategy for this repository
public GenericJpaRepository(javax.persistence.EntityManager entityManager,
Class<T> aggregateType,
LockManager lockManager)
aggregateType with an additional
lockManager.
entityManager - The EntityManager instance for this repositoryaggregateType - the aggregate type this repository manageslockManager - the additional locking strategy for this repository| Method Detail |
|---|
protected void doSaveWithLock(T aggregate)
LockingRepository
doSaveWithLock in class LockingRepository<T extends AggregateRoot>aggregate - the aggregate to storeprotected void doDeleteWithLock(T aggregate)
LockingRepository
doDeleteWithLock in class LockingRepository<T extends AggregateRoot>aggregate - the aggregate to delete
protected T doLoad(Object aggregateIdentifier,
Long expectedVersion)
LockingRepository
doLoad in class LockingRepository<T extends AggregateRoot>aggregateIdentifier - the identifier of the aggregate to loadexpectedVersion - The expected version of the aggregate
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 | |||||||||