@Test @DirtiesContext void testStoreSagaWithCustomEntity() { JpaSagaStore sagaStore = new JpaSagaStore( JpaSagaStore.builder() .serializer(secureXStreamSerializer()) .entityManagerProvider(new SimpleEntityManagerProvider(entityManager)) ) { @Override protected AbstractSagaEntry<?> createSagaEntry(Object saga, String sagaIdentifier, Serializer serializer) { return new CustomSagaEntry(saga, sagaIdentifier, serializer); } @Override protected String sagaEntryEntityName() { return CustomSagaEntry.class.getSimpleName(); } @Override protected Class<? extends SimpleSerializedObject<?>> serializedObjectType() { return CustomSerializedSaga.class; } }; repository = AnnotatedSagaRepository.<StubSaga>builder().sagaType(StubSaga.class).sagaStore(sagaStore).build(); String identifier = unitOfWork.executeWithResult( () -> repository.createInstance(IdentifierFactory.getInstance().generateIdentifier(), StubSaga::new) .getSagaIdentifier() ).getPayload(); assertFalse(entityManager.createQuery("SELECT e FROM CustomSagaEntry e").getResultList().isEmpty()); entityManager.clear(); startUnitOfWork(); unitOfWork.execute(() -> { Saga<StubSaga> loaded = repository.load(identifier); loaded.execute(StubSaga::end); assertNotNull(entityManager.find(CustomSagaEntry.class, identifier)); }); }
public static Builder builder() { return new Builder(); }
JpaSagaStore implements SagaStore<Object> { public static Builder builder() { return new Builder(); } }
JpaSagaStore implements SagaStore<Object> { public static Builder builder() { return new Builder(); } protected  JpaSagaStore(Builder builder); }
JpaSagaStore implements SagaStore<Object> { public static Builder builder() { return new Builder(); } protected  JpaSagaStore(Builder builder); static Builder builder(); @Override Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier); @Override Set<String> findSagas(Class<?> sagaType, AssociationValue associationValue); @Override void deleteSaga(Class<?> sagaType, String sagaIdentifier, Set<AssociationValue> associationValues); @Override void updateSaga(Class<?> sagaType, String sagaIdentifier, Object saga, AssociationValues associationValues); @Override void insertSaga(Class<?> sagaType, String sagaIdentifier, Object saga,
                           Set<AssociationValue> associationValues); void setUseExplicitFlush(boolean useExplicitFlush); }
JpaSagaStore implements SagaStore<Object> { public static Builder builder() { return new Builder(); } protected  JpaSagaStore(Builder builder); static Builder builder(); @Override Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier); @Override Set<String> findSagas(Class<?> sagaType, AssociationValue associationValue); @Override void deleteSaga(Class<?> sagaType, String sagaIdentifier, Set<AssociationValue> associationValues); @Override void updateSaga(Class<?> sagaType, String sagaIdentifier, Object saga, AssociationValues associationValues); @Override void insertSaga(Class<?> sagaType, String sagaIdentifier, Object saga,
                           Set<AssociationValue> associationValues); void setUseExplicitFlush(boolean useExplicitFlush);  }