Slide 8
Slide 8 text
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Lambdas with existing Spring APIs
8 @snicoll
JdbcTemplate jt = new JdbcTemplate(dataSource);
jt.query("SELECT name, age FROM person WHERE dep = ?",
ps -> ps.setString(1, "Sales"),
(rs, rowNum) -> new Person(rs.getString(1), rs.getInt(2)));
jt.query("SELECT name, age FROM person WHERE dep = ?",
ps -> {
ps.setString(1, "Sales");
},
(rs, rowNum) -> {
return new Person(rs.getString(1), rs.getInt(2));
});