Class GenericHandleAwareUnitOfWorkFactory.GenericHandleAwareUnitOfWork

    • Method Detail

      • registerLifecycleCallbackForResource

        public <T> T registerLifecycleCallbackForResource​(T resource,
                                                          UnitOfWorkLifecycleCallback<T> associatedUnitOfWorkCallback)
        Description copied from interface: UnitOfWork
        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 {
        Specified by:
        registerLifecycleCallbackForResource in interface UnitOfWork
        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
      • afterClosingHandle

        protected void afterClosingHandle()
        Called right after the Handle is closed. Perform any additional clean-ups by overriding this method
      • afterCommitting

        protected void afterCommitting()
        Called right after Handle.commit() has been called.
      • beforeCommitting

        protected void beforeCommitting()
        Called right before Handle.commit() is called.
      • afterRollback

        protected void afterRollback​(Exception cause)
        Called right after Handle.rollback() has been called.
        Parameters:
        cause - the cause of the rollback
      • beforeRollback

        protected void beforeRollback​(Exception cause)
        Called right before Handle.rollback() is called.
        Parameters:
        cause - the cause of the rollback