Correctness21 - SpotBugsExtensionForSpringFrameWork/CS5098 GitHub Wiki
Bug name: Bad SQL Grammar
Description
thrown when attempting to run a query with invalid SQL:
@Test(expected = BadSqlGrammarException.class)
public void whenIncorrectSql_thenBadSqlGrammarException() {
JdbcTemplate jdbcTemplate = new JdbcTemplate(restDataSource);
jdbcTemplate.queryForObject("select * fro foo where id=3", Integer.class); // fro ...?
}
Solutions
Reference List
https://www.baeldung.com/nontransientdataaccessexception#1-badsqlgrammarexception