JdbcTemplate
JdbcTemplate is Spring’s helper class for running SQL through JDBC. It opens and closes connections, prepares statements, loops through result sets, and handles exceptions for you. Traditional JDBC needs about 15 lines (connection, statement, result set, try/catch/finally) for one query. With JdbcTemplate it is one line: jdbcTemplate.query(sql, rowMapper, args). It also turns checked SQLExceptions into […]
