在Java中执行查询后如何存储数据

时间:2018-08-24 01:56:10

标签: java spring jdbc db2

这是在成功执行jdbcCall.execute(in)之后的存储过程调用,我将如何返回响应?目前,我收到null作为响应。

public SPDynamicReportResponseDomain getSpResult() {
    SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate).withSchemaName("app").withProcedureName("GetDatareport");

    jdbcCall.declareParameters(

            new SqlParameter("INREPORTID", Types.INTEGER),
            new SqlParameter("INVIEW", Types.VARCHAR),
            new SqlParameter("INDATE", Types.VARCHAR),
            new SqlParameter("INTYPE", Types.VARCHAR),
            new SqlParameter("INCTL1", Types.VARCHAR),
            new SqlParameter("INCTL2", Types.VARCHAR),
            new SqlParameter("INCTL3", Types.VARCHAR),
            new SqlParameter("INCTL4", Types.VARCHAR),
            new SqlParameter("INCTL5", Types.VARCHAR),
            new SqlParameter("INFROMBODY", Types.VARCHAR),
            new SqlParameter("INLANG", Types.VARCHAR)
            );

    Map<String, Object> inParamMap = new HashMap<String, Object>();
    inParamMap.put("INREPORTID", 528);
    inParamMap.put("INVIEW", "YM");
    inParamMap.put("INDATE", "2018-08-12");
    inParamMap.put("INTYPE", null) ;
    inParamMap.put("INCTL1", "PL_01");
    inParamMap.put("INCTL2",null );
    inParamMap.put("INCTL3", "KPI_01_PL_01_1" );
    inParamMap.put("INCTL4", "mitZeitSchranke");
    inParamMap.put("INCTL5", "0");
    inParamMap.put("INFROMBODY", null);
    inParamMap.put("INLANG", "DE");
    SqlParameterSource in = new MapSqlParameterSource().addValues(inParamMap);

    Map<String, Object> simpleJdbcCallResult = jdbcCall.execute(in);
    System.out.println(simpleJdbcCallResult);
    in.getValue(sql);



    dynamicReportResponseDomain.setClusterId1((Integer) simpleJdbcCallResult.get("CLUSTERID2"));
    dynamicReportResponseDomain.setClusterId2((Integer) simpleJdbcCallResult.get("CLUSTERID2"));
    dynamicReportResponseDomain.setClusterId3((Integer) simpleJdbcCallResult.get("CLUSTERID3"));



    return dynamicReportResponseDomain;
}

0 个答案:

没有答案