Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Actor findActor(long id) {
- String sql = "select id, first_name, last_name from T_ACTOR where id = ?";
- ParameterizedRowMapper<Actor> mapper = new ParameterizedRowMapper<Actor>() {
- // notice the return type with respect to Java 5 covariant return types
- public Actor mapRow(ResultSet rs, int rowNum) throws SQLException {
- Actor actor = new Actor();
- actor.setId(rs.getLong("id"));
- actor.setFirstName(rs.getString("first_name"));
- actor.setLastName(rs.getString("last_name"));
- return actor;
- }
- };
- return this.simpleJdbcTemplate.queryForObject(sql, mapper, id);
- }
Add Comment
Please, Sign In to add comment