@Override public void doClose() { // rollback when session is dirty so that no statement leaks from one use of the DbSession to another // super.close() would do such rollback before actually closing **if autocommit is true** // we are going to assume autocommit is true and keep this behavior if (dirty) { getDelegate().rollback(); } }
@Override public DbSession openSession(boolean batch) { if (!CACHING_ENABLED.get()) { return myBatis.openSession(batch); } if (batch) { return new NonClosingDbSession(batchDbSession.get().get()); } return new NonClosingDbSession(regularDbSession.get().get()); }