Karldmoore you would throw a runtime exception the same as any other exception. If your custom exception is a checked exception and not a runtime exception then throw your custom exception out of the catch block for the DataAccessException.
btw DataAccessException is a runtime exception
Code:
Code:
try
{
getJdbcTemplate().query(query,searchParams, new ResultSetExtractor() {
public Object extractData(ResultSet rs) throws SQLException {
while (rs.next()) {
//throw exception here if business rules are not validated successfully
// any runtime exception will do
throw new DataAccessException("my message");
}return null;
}
});
}catch(DataAccessException dae){
//catch it here and rethrow your custom exception forget this step if your custom exception is a runtime exception //you can just throw it above
throw new CustomException(dae.getMessage(), dae);
}