Interface NonFlushingSessionWrapper

All Known Implementing Classes:
HibernateNonFlushingSessionWrapper

public interface NonFlushingSessionWrapper
Since:
8.5.22
  • Method Details

    • executeThenClearSessionWithoutCommitOrFlush

      int executeThenClearSessionWithoutCommitOrFlush(int batchSize, int expectedTotal, Function<Integer,Integer> taskExecutor)
      Execute tasks in batches, re-using the existing transaction rather than nesting transactions. WARNING: the session clearing will discard any unflushed or uncommitted changes made higher in the stack. Use this method only for the operations that do not write to database. Also, the existing transaction will not be committed in this method.
      Parameters:
      batchSize - the positive number of tasks to execute in a batch, before any hibernate flush or clears.
      expectedTotal - the positive total number of tasks to be executed.
      taskExecutor - the task executor. The taskExecutor should accept the batchSize to execute, and return how many tasks have been successfully executed.
      Returns:
      the number of tasks which were executed successfully.