Beispiel #1
0
 public void close() throws SQLException, TransactionException {
   if (executor != null) {
     try {
       isolationLevel.restoreIsolationLevel(executor.getTransaction().getConnection());
     } finally {
       executor.close(false);
       executor = null;
     }
   }
 }
Beispiel #2
0
 private void init() throws SQLException, TransactionException {
   // Open JDBC Transaction
   Connection connection = dataSource.getConnection();
   connection = ConnectionLogger.newInstance(connection);
   if (connection == null) {
     throw new TransactionException(
         "JdbcTransaction could not start transaction.  Cause: The DataSource returned a null connection.");
   }
   // Isolation Level
   isolationLevel.applyIsolationLevel(connection);
   // AutoCommit
   if (connection.getAutoCommit()) {
     connection.setAutoCommit(false);
   }
   executor =
       configuration.newExecutor(
           new org.apache.ibatis.transaction.jdbc.JdbcTransaction(connection, false));
 }