为什么session.close(),之后不进行事务回滚

public void close() {
    try {
      executor.close(isCommitOrRollbackRequired(false));
//这里将dirty变为假
      dirty = false;
    } finally {
      ErrorContext.instance().reset();
    }
  }
public void commit(boolean force) {
    try {
//导致commit(为假)
      executor.commit(isCommitOrRollbackRequired(force));
      dirty = false;
    } catch (Exception e) {
      throw ExceptionFactory.wrapException("Error committing transaction.  Cause: " + e, e);
    } finally {
      ErrorContext.instance().reset();
    }
  }
public void commit(boolean required) throws SQLException {
    if (closed) throw new ExecutorException("Cannot commit, transaction is already closed");
    clearLocalCache();
    flushStatements();
//required为假,不进行回滚
    if (required) {
      transaction.commit();
    }
  }

你可能感兴趣的:(为什么session.close(),之后不进行事务回滚)