public <CT>CT callBatchTasks(DatabaseConnection connection,boolean saved,Callable<CT> callable) throws SQLException {
  if (databaseType.isBatchUseTransaction()) {
    return TransactionManager.callInTransaction(connection,saved,databaseType,callable);
  }
  boolean autoCommitAtStart=false;
  try {
    if (connection.isAutoCommitSupported()) {
      autoCommitAtStart=connection.isAutoCommit();
      if (autoCommitAtStart) {
        connection.setAutoCommit(false);
        logger.debug("disabled auto-commit on table {} before batch tasks",tableInfo.getTableName());
      }
    }
    try {
      return callable.call();
    }
 catch (    SQLException e) {
      throw e;
    }
catch (    Exception e) {
      throw SqlExceptionUtil.create("Batch tasks callable threw non-SQL exception",e);
    }
  }
  finally {
    if (autoCommitAtStart) {
      connection.setAutoCommit(true);
      logger.debug("re-enabled auto-commit on table {} after batch tasks",tableInfo.getTableName());
    }
  }
}

public < CT > CT callBatchTasks ( DatabaseConnection connection , boolean saved , Callable < CT > callable ) throws SQLException { if ( databaseType . isBatchUseTransaction ( ) ) { return TransactionManager . callInTransaction ( connection , saved , databaseType , callable ) ; } boolean autoCommitAtStart = false ; try { if ( connection . isAutoCommitSupported ( ) ) { autoCommitAtStart = connection . isAutoCommit ( ) ; if ( autoCommitAtStart ) { connection . setAutoCommit ( false ) ; logger . debug ( "disabled auto-commit on table {} before batch tasks" , tableInfo . getTableName ( ) ) ; } } try { return callable . call ( ) ; } catch ( SQLException e ) { throw e ; } catch ( Exception e ) { throw SqlExceptionUtil . create ( "Batch tasks callable threw non-SQL exception" , e ) ; } } finally { if ( autoCommitAtStart ) { connection . setAutoCommit ( true ) ; logger . debug ( "re-enabled auto-commit on table {} after batch tasks" , tableInfo . getTableName ( ) ) ; } } }
call batch tasks inside of a connection which may , or may not , have been " saved " .
