I need to save the result of this query in the resultSet [rsf] as I do it please!

0
    String sql = "SELECT trainings.TRAINING_NAME AS capacitacion_nombre, area_members.area as area ," +
            "beneficted_area.TRAINING_MONTH as month , AVG(beneficted_area.TRAINING_SCORE) AS score" +
            "FROM " +
            "area_members,beneficted_area ,trainings " +
            "WHERE area_members.name=beneficted_area.PARTICIPANT_NAME " +
            "AND trainings.ID_TRAINIG=beneficted_area.ID_TRAINIG" +
            "group by area,month, capacitacion_nombre ORDER BY 'CAPACITACION_NOMBRE' ASC";

    jdbcTemplate.query(sql, (rs, rowNum) -> this.rsf = rs);
    
asked by Boris Raul Cutos 10.05.2018 в 20:25
source

1 answer

0

You can do it this way with a list of the object you want to save, scroll rs with a while and you can settear value them on that object to be able to add it to the list.

This is an example:

List<AreaMembers> list = new ArrayList<>();

while (rs.next()) {
  AreaMembers info = new AreaMembers();
  info.setAdId(rs.getInt("ad_id"));
  ...
  list.add(info);
}
    
answered by 11.05.2018 в 16:34