I am using the JdbcTemplate.query(sql, args, rowMapper)
method call to return a list of objects. There are some cases where I want to skip a row and not add it to the list that I return. In these cases, I've thought of two solutions:
- Have RowMapper return null.
- Have RowMapper throw an Exception (I know SQLExceptions are handled so this is one possibility).
My question is: When RowMapper.mapRow
returns null, does JdbcTemplate add it to the list? If not, should I throw an SQLException instead?