public Connection getConnection() { return sqlSessionTemplate.getConnection(); }
@Override public void releaseSavepoint(Savepoint savepoint) { try { Connection connection = template.getConnection(); connection.releaseSavepoint(savepoint); } catch (SQLException e) { throw new RuntimeException("Failed to create SAVEPOINT: " + savepoint, e); } } }
@Override public void releaseSavepoint(Savepoint savepoint) { try { Connection connection = template.getConnection(); connection.releaseSavepoint(savepoint); } catch (SQLException e) { throw new RuntimeException("Failed to create SAVEPOINT: " + savepoint, e); } } }
/** * Calls through to the {@link Connection#setSavepoint(String) current connection}. */ @Override public void rollbackToSavepoint(Savepoint savepoint) { try { Connection connection = template.getConnection(); connection.rollback(savepoint); } catch (SQLException e) { throw new RuntimeException("Failed to create SAVEPOINT: " + savepoint, e); } } @Override
/** * Calls through to the {@link Connection#setSavepoint(String) current connection}. */ @Override public void rollbackToSavepoint(Savepoint savepoint) { try { Connection connection = template.getConnection(); connection.rollback(savepoint); } catch (SQLException e) { throw new RuntimeException("Failed to create SAVEPOINT: " + savepoint, e); } } @Override
/** * Calls through to the {@link Connection#setSavepoint(String) current connection}. */ @Override public Savepoint createSavepoint(final String savepoint) { try { Connection connection = template.getConnection(); return connection.setSavepoint(savepoint); } catch (SQLException e) { throw new RuntimeException("Failed to create SAVEPOINT: " + savepoint, e); } } /**
/** * Calls through to the {@link Connection#setSavepoint(String) current connection}. */ @Override public Savepoint createSavepoint(final String savepoint) { try { Connection connection = template.getConnection(); return connection.setSavepoint(savepoint); } catch (SQLException e) { throw new RuntimeException("Failed to create SAVEPOINT: " + savepoint, e); } } /**
@Override public int setTransactionIsolationLevel(int isolationLevel) { Connection connection = template.getConnection(); if (connection == null) { throw new NullPointerException("There is no current connection"); } try { if (!connection.getMetaData().supportsTransactionIsolationLevel(isolationLevel)) { throw new IllegalStateException("Transaction isolation level not supported: " + isolationLevel); } int isolationLevelWas = connection.getTransactionIsolation(); connection.setTransactionIsolation(isolationLevel); return isolationLevelWas; } catch (SQLException e) { throw new IllegalStateException("Failed to set transaction isolation level: " + isolationLevel, e); } } }
@Override public int setTransactionIsolationLevel(int isolationLevel) { Connection connection = template.getConnection(); if (connection == null) { throw new NullPointerException("There is no current connection"); } try { if (!connection.getMetaData().supportsTransactionIsolationLevel(isolationLevel)) { throw new IllegalStateException("Transaction isolation level not supported: " + isolationLevel); } int isolationLevelWas = connection.getTransactionIsolation(); connection.setTransactionIsolation(isolationLevel); return isolationLevelWas; } catch (SQLException e) { throw new IllegalStateException("Failed to set transaction isolation level: " + isolationLevel, e); } } }