25. ≪ 補足≫匿名クラスを使わない書き方 class MyRowMapper implements RowMapper<Pet> { public Pet mapRow(ResultSet rs, int rowNum) throws SQLException { Pet p = new Pet(); p.setPetId(rs.getInt("pet_id")); p.setPetName(rs.getString("pet_name")); p.setOwnerName(rs.getString("owner_name")); return p; } } Pet pet = jdbcTemplate.queryForObject( "select * from pet where pet_id=?" ,new MyRowMapper() ,id);