Class JpaSagaStore
java.lang.Object
org.axonframework.modelling.saga.repository.legacyjpa.JpaSagaStore
Deprecated.
JPA implementation of the
SagaStore. It uses an EntityManager to persist the actual saga in a backing
store in serialized form.
After each operation that modified the backing store, EntityManager.flush() is invoked to ensure the store
contains the last modifications. To override this behavior, see setUseExplicitFlush(boolean)- Since:
- 3.0
- Author:
- Allard Buijze
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.Builder class to instantiate aJpaSagaStore.Nested classes/interfaces inherited from interface org.axonframework.modelling.saga.repository.SagaStore
SagaStore.Entry<T> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJpaSagaStore(JpaSagaStore.Builder builder) Deprecated.Instantiate aJpaSagaStorebased on the fields contained in theJpaSagaStore.Builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic JpaSagaStore.Builderbuilder()Deprecated.Instantiate a Builder to be able to create aJpaSagaStore.protected SagaEntry<?> createSagaEntry(Object saga, String sagaIdentifier, Serializer serializer) Deprecated.Intended for clients to override.voiddeleteSaga(Class<?> sagaType, String sagaIdentifier, Set<AssociationValue> associationValues) Deprecated.Deletes a Saga with givensagaTypeandsagaIdentifierand all its associations.findSagas(Class<?> sagaType, AssociationValue associationValue) Deprecated.Returns identifiers of saga instances of the givensagaTypethat have been associated with the givenassociationValue.voidinsertSaga(Class<?> sagaType, String sagaIdentifier, Object saga, Set<AssociationValue> associationValues) Deprecated.Adds a new Saga and its initial association values to the store.protected Set<AssociationValue> loadAssociationValues(javax.persistence.EntityManager entityManager, Class<?> sagaType, String sagaIdentifier) Deprecated.<S> SagaStore.Entry<S> Deprecated.protected voidremoveAssociationValue(javax.persistence.EntityManager entityManager, Class<?> sagaType, String sagaIdentifier, AssociationValue associationValue) Deprecated.Removes the givenassociationValueof the saga with givensagaIdentifierandsagaType.protected StringDeprecated.Intended for clients to override.protected Class<? extends SimpleSerializedObject<?>> Deprecated.Intended for clients to override.voidsetUseExplicitFlush(boolean useExplicitFlush) Deprecated.Sets whether or not to do an explicitEntityManager.flush()after each data modifying operation on the backing storage.protected voidstoreAssociationValue(javax.persistence.EntityManager entityManager, Class<?> sagaType, String sagaIdentifier, AssociationValue associationValue) Deprecated.Stores the givenassociationValueof the saga with givensagaIdentifierandsagaType.voidupdateSaga(Class<?> sagaType, String sagaIdentifier, Object saga, AssociationValues associationValues) Deprecated.Updates a given Saga after its state was modified.
-
Constructor Details
-
JpaSagaStore
Deprecated.Instantiate aJpaSagaStorebased on the fields contained in theJpaSagaStore.Builder.Will assert that the
EntityManagerProviderandSerializerare notnull, and will throw anAxonConfigurationExceptionif any of them isnull.- Parameters:
builder- theJpaSagaStore.Builderused to instantiate aJpaSagaStoreinstance
-
-
Method Details
-
builder
Deprecated.Instantiate a Builder to be able to create aJpaSagaStore.The
EntityManagerProviderandSerializerare hard requirements and as such should be provided.- Returns:
- a Builder to be able to create a
JpaSagaStore
-
loadSaga
Deprecated.Description copied from interface:SagaStoreLoads a known sagaSagaStore.Entryinstance with givensagaTypeand uniquesagaIdentifier.Due to the concurrent nature of Sagas, it is not unlikely for a Saga to have ceased to exist after it has been found based on associations. Therefore, a repository should return
nullin case a Saga doesn't exists, as opposed to throwing an exception. -
loadAssociationValues
protected Set<AssociationValue> loadAssociationValues(javax.persistence.EntityManager entityManager, Class<?> sagaType, String sagaIdentifier) Deprecated.- Parameters:
entityManager- the entity manager instance to use for the querysagaType- the saga instance classsagaIdentifier- the saga identifier- Returns:
- the associations of the given saga
-
removeAssociationValue
protected void removeAssociationValue(javax.persistence.EntityManager entityManager, Class<?> sagaType, String sagaIdentifier, AssociationValue associationValue) Deprecated.Removes the givenassociationValueof the saga with givensagaIdentifierandsagaType.- Parameters:
entityManager- the entity manager instance to use for the querysagaType- the saga instance classsagaIdentifier- the saga identifierassociationValue- the association value to remove
-
storeAssociationValue
protected void storeAssociationValue(javax.persistence.EntityManager entityManager, Class<?> sagaType, String sagaIdentifier, AssociationValue associationValue) Deprecated.Stores the givenassociationValueof the saga with givensagaIdentifierandsagaType.- Parameters:
entityManager- the entity manager instance to use for the querysagaType- the saga instance classsagaIdentifier- the saga identifierassociationValue- the association value to add
-
findSagas
Deprecated.Description copied from interface:SagaStoreReturns identifiers of saga instances of the givensagaTypethat have been associated with the givenassociationValue. -
deleteSaga
public void deleteSaga(Class<?> sagaType, String sagaIdentifier, Set<AssociationValue> associationValues) Deprecated.Description copied from interface:SagaStoreDeletes a Saga with givensagaTypeandsagaIdentifierand all its associations. For convenience all known association values are passed along as well, which has the advantage that the saga store is not required to keep an index of association value to saga identifier.- Specified by:
deleteSagain interfaceSagaStore<Object>- Parameters:
sagaType- The type of saga to deletesagaIdentifier- The identifier of the saga to deleteassociationValues- The known associations of the saga
-
updateSaga
public void updateSaga(Class<?> sagaType, String sagaIdentifier, Object saga, AssociationValues associationValues) Deprecated.Description copied from interface:SagaStoreUpdates a given Saga after its state was modified. The tracking token of the event last handled by the Saga is also passed as a parameter. Note that the giventokenmay benullif the Saga is not tracking the event store.- Specified by:
updateSagain interfaceSagaStore<Object>- Parameters:
sagaType- The type of the SagasagaIdentifier- The identifier of the Sagasaga- The Saga instanceassociationValues- The initial association values of the Saga
-
insertSaga
public void insertSaga(Class<?> sagaType, String sagaIdentifier, Object saga, Set<AssociationValue> associationValues) Deprecated.Description copied from interface:SagaStoreAdds a new Saga and its initial association values to the store. The tracking token of the event last handled by the Saga (usually the event that started the Saga) is also passed as a parameter. Note that the giventokenmay benullif the Saga is not tracking the event store.- Specified by:
insertSagain interfaceSagaStore<Object>- Parameters:
sagaType- The type of the SagasagaIdentifier- The identifier of the Sagasaga- The Saga instanceassociationValues- The initial association values of the Saga
-
setUseExplicitFlush
public void setUseExplicitFlush(boolean useExplicitFlush) Deprecated.Sets whether or not to do an explicitEntityManager.flush()after each data modifying operation on the backing storage. Default totrue- Parameters:
useExplicitFlush-trueto force flush,falseotherwise.
-
createSagaEntry
Deprecated.Intended for clients to override. Defaults toSagaEntry.- Parameters:
saga- The Saga instancesagaIdentifier- The identifier of the Sagaserializer- The serializer to serialize to theSagaEntry.getSerializedSaga()- Returns:
- An instanceof @
SagaEntry
-
sagaEntryEntityName
Deprecated.Intended for clients to override. Defaults to 'SagaEntry'.- Returns:
- the name of the Jpa event entity
-
serializedObjectType
Deprecated.Intended for clients to override. Defaults toSerialzedSaga.class- Returns:
- the serialized object type of the Saga this
SagaStorestores
-
JpaSagaStorewhich moved to jakarta.