@Override public Transaction newTransaction(DataSource ds, TransactionIsolationLevel level, boolean autoCommit) { return new JdbcTransaction(ds, level, autoCommit); } }
@Override public Connection getConnection() throws SQLException { if (connection == null) { openConnection(); } return connection; }
protected void openConnection() throws SQLException { if (log.isDebugEnabled()) { log.debug("Opening JDBC Connection"); } connection = dataSource.getConnection(); if (level != null) { connection.setTransactionIsolation(level.getLevel()); } setDesiredAutoCommit(autoCommmit); }
@Override public void close() throws SQLException { if (connection != null) { resetAutoCommit(); if (log.isDebugEnabled()) { log.debug("Closing JDBC Connection [" + connection + "]"); } connection.close(); } }
protected void openConnection() throws SQLException { if (log.isDebugEnabled()) { log.debug("Opening JDBC Connection"); } connection = dataSource.getConnection(); if (level != null) { connection.setTransactionIsolation(level.getLevel()); } setDesiredAutoCommit(autoCommit); }
@Override public void close() throws SQLException { if (connection != null) { resetAutoCommit(); if (log.isDebugEnabled()) { log.debug("Closing JDBC Connection [" + connection + "]"); } connection.close(); } }
@Override public Transaction newTransaction(DataSource ds, TransactionIsolationLevel level, boolean autoCommit) { return new JdbcTransaction(ds, level, autoCommit); } }
public JdbcTransaction(Connection connection, boolean desiredAutoCommit) { this.connection = connection; setDesiredAutoCommit(desiredAutoCommit); }
public void close() throws SQLException { resetAutoCommit(); connection.close(); }
@Override public Connection getConnection() throws SQLException { if (connection == null) { openConnection(); } return connection; }
@Override public Transaction newTransaction(Connection conn) { return new JdbcTransaction(conn); }
@Override public Transaction newTransaction(Connection conn) { return new JdbcTransaction(conn); }
public Transaction newTransaction(Connection conn, boolean autoCommit) { return new JdbcTransaction(conn, autoCommit); }
private Executor newExecutor() throws SQLException { Environment environment = configuration.getEnvironment(); if (environment == null) throw new ExecutorException("ResultLoader could not load lazily. Environment was not configured."); DataSource ds = environment.getDataSource(); if (ds == null) throw new ExecutorException("ResultLoader could not load lazily. DataSource was not configured."); Connection conn = ds.getConnection(); conn = wrapConnection(conn); Transaction tx = new JdbcTransaction(conn, false); return configuration.newExecutor(tx, ExecutorType.SIMPLE); }