@Test public void logsAllUnderlyingCauses() { SQLException one = new SQLException("a"); SQLException two = new SQLException("b"); SQLException e = new SQLException("fail"); e.setNextException(one); e.setNextException(two); DataAccessException dae = new DataAccessException("moar fail", e); mapper.logException(0, dae); verify(logger).error(anyString(), eq(e)); verify(logger).error(anyString(), eq(one)); verify(logger).error(anyString(), eq(two)); }
@Override protected void logException(long id, DataAccessException exception) { final Throwable cause = exception.getCause(); if (cause instanceof SQLException) { for (Throwable throwable : (SQLException) cause) { logger.error(formatLogMessage(id, throwable), throwable); } } else { logger.error(formatLogMessage(id, exception), exception); } }
LoggingDataAccessExceptionMapper extends LoggingExceptionMapper<DataAccessException> { @Override protected void logException(long id, DataAccessException exception) { final Throwable cause = exception.getCause(); if (cause instanceof SQLException) { for (Throwable throwable : (SQLException) cause) { logger.error(formatLogMessage(id, throwable), throwable); } } else { logger.error(formatLogMessage(id, exception), exception); } } }
LoggingDataAccessExceptionMapper extends LoggingExceptionMapper<DataAccessException> { @Override protected void logException(long id, DataAccessException exception) { final Throwable cause = exception.getCause(); if (cause instanceof SQLException) { for (Throwable throwable : (SQLException) cause) { logger.error(formatLogMessage(id, throwable), throwable); } } else { logger.error(formatLogMessage(id, exception), exception); } }  }
LoggingDataAccessExceptionMapper extends LoggingExceptionMapper<DataAccessException> { @Override protected void logException(long id, DataAccessException exception) { final Throwable cause = exception.getCause(); if (cause instanceof SQLException) { for (Throwable throwable : (SQLException) cause) { logger.error(formatLogMessage(id, throwable), throwable); } } else { logger.error(formatLogMessage(id, exception), exception); } }   }
LoggingDataAccessExceptionMapper extends LoggingExceptionMapper<DataAccessException> { @Override protected void logException(long id, DataAccessException exception) { final Throwable cause = exception.getCause(); if (cause instanceof SQLException) { for (Throwable throwable : (SQLException) cause) { logger.error(formatLogMessage(id, throwable), throwable); } } else { logger.error(formatLogMessage(id, exception), exception); } }    }