@Override protected void starting(Description description) { try { if (delegate == null || delegate.isClosed()) delegate = getNewConnection(); if (!autoCommit) delegate.setAutoCommit(false); } catch (Exception e) { throw new RuntimeException(e); } }
@Override protected void finished(Description description) { if (!autoCommit && delegate != null) { try { if (!delegate.isClosed()) { delegate.rollback(); delegate.reset(); } } catch (SQLException se) { throw new RuntimeException(se); } } }
@Override public boolean isClosed() throws SQLException { return delegate.isClosed(); }