public JdbcDaoTransaction(DataSource dataSource) {
try {
connection = dataSource.getConnection();
if (connection == null) {
throw new DaoException("Could not start transaction. Cause: The DataSource returned a null connection.");
}
if (connection.getAutoCommit()) {
connection.setAutoCommit(false);
}
if (connectionLog.isDebugEnabled()) {
connection = ConnectionLogger.newInstance(connection);
}
} catch (SQLException e) {
throw new DaoException("Error starting JDBC transaction. Cause: " + e);
}
}