Interface UnitOfWork

    • Method Detail

      • start

        void start()
        Start the UnitOfWork and any underlying transaction
      • markAsRollbackOnly

        default void markAsRollbackOnly()
      • markAsRollbackOnly

        void markAsRollbackOnly​(Exception cause)
      • registerLifecycleCallbackForResource

        <T> T registerLifecycleCallbackForResource​(T resource,
                                                   UnitOfWorkLifecycleCallback<T> associatedUnitOfWorkCallback)
        TODO: Adjust example to the new API Register a resource (e.g. an Aggregate) that should have its UnitOfWorkLifecycleCallback called during UnitOfWork operation.
        Example:
        
         Aggregate aggregate = unitOfWork.registerLifecycleCallbackForResource(aggregate.loadFromEvents(event),
                                                                               new AggregateRootRepositoryUnitOfWorkLifecycleCallback()));
         
        Where the Aggreg
        {@code
         class AggregateRootRepositoryUnitOfWorkLifecycleCallback implements UnitOfWorkLifecycleCallback {
        Type Parameters:
        T - the type of resource
        Parameters:
        resource - the resource that should be tracked
        associatedUnitOfWorkCallback - the callback instance for the given resource
        Returns:
        the resource or a proxy to it