CallbackHandler is a interface used by JdbcTemplate’s query methods. This interface cantains only one method with the signature in the following code snippet. The implementation class of this interface needs to implements the processRow() method, which take responsibility to process each row of data in the ResultSet. The processRow() method should not call next()...
JdbcTemplate class includes query methods to prepare and execute the SQL queries. The Spring JDBC abstraction framewor provides three different types of callbacks to read the results after executing the SQL query using query() methods. ResultSetExtractor RowCallbackHandler RowMapper Let’s start our discussion with ResultSetExtractor. ResultSetExtractor contains only one method with the regnature shown in...
JdbcTemplate proveides update() methods for executing single SQL DML statement. It support JDBC statement and PreparedStatement style of eecuting the SQL statements. Following example demonstrates all the update methods of JdbcTemplate. To make this example simple, we are using ‘Product’ table. Following SQL Script show the table description. Following Dao Interface shows the minimum...