使用simplejdbc调用获得的循环结果集

时间:2018-12-23 09:05:27

标签: spring-boot spring-data-jpa spring-jdbc jdbctemplate simplejdbccall

我有一个存储过程,它将向我返回记录列表。我可以从过程中调用并获取值。在解析结果集值时需要帮助。我需要遍历结果集值,并将其转换为分类信息对象列表。

请从以下过程中找到我返回的结果集: resultset obtained from procedure using simpleJDBCCall 请在下面找到代码:

public List<ClassificationInfo> findAll(){
    SimpleJDBCCall simpleJdbcCall = new SimpleJDBCCall(jdbcTemplate).withProcedureName("uspFetchItems");
    Map<String, Object> inputParam = new HashMap<String, Object>();
    List<ClassificationInfo> classificationList = new ArrayList<>();
    inputParam.put("items",2);
    SqlParameterSource in = new MapSqlParameterSource(inputParam);
    Map<String, Object> simpleJDBCResult = simpleJdbcCall.execute(in);
    simpleJDBCResult.entrySet().parallelStream().forEach(ItemEntries ->{
      //do something here

    });

0 个答案:

没有答案