Sunday, June 30, 2019

Spring JdbcTemplate

PreparedStatement
RowMapper
ResultSetExtractor
NamedParameter
BeanPropertyRowMapper

ResultSetExtractor: 
  • org.springframework.jdbc.core.ResultSetExtractor is a callback interface.
  • This is used to extracting results from a ResultSet. 
  • ResultSetExtractor is used if we required.one result object for the entire ResultSet.
RowMapper: 
  • org.springframework.jdbc.core.RowMapper<T> is a interface.
  • This is used by JdbcTemplate to map each row of a ResultSet to a result object "per-row basis".
  • A RowMapper is use to process ResultSet, mapping one result object per row.

new Object[] { empId }: passing the id as a parameter to the query
new BeanPropertyRowMapper<Employee>(Employee.class): BeanPropertyRowMapper is use to map the results from ResultSet to the Employee bean.


Related Tutorial

No comments:

Post a Comment