I had a working RowMapper code that maps database table row in to a java object. I wanted to change the implementation using lambda expression. However, I am always getting error; Code snippet as follows;
String queryString = "select * from person where person_id = ? ";
RowMapper rowMapper = (rs, rowNum) -> {
Person p = new Person();
p.setName(rs.getString("personName"));
p.setAddress(rs.getString("address"));
p.setAge(rs.getInt("age"));
}
Person person = getJdbcTemplate().query(queryString, personId, rowMapper);
return person;
Can someone help me to implement code correctly? Any idea to get list of persons?
}
?. IsRowMapper
a functional interface? What version of spring are you using? – Surgy