0

我在 Dao 课上有这个 SP:

private class ScoreStoredProcedure extends StoredProcedure {
    private static final String SPROC_NAME = "loadUserScore";

    public ScoreStoredProcedure(DataSource datasource) {
        super(datasource, SPROC_NAME);

        declareParameter(new SqlReturnResultSet("score", mScoreMapper));
        declareParameter(new SqlParameter("vusername", Types.VARCHAR));
        declareParameter(new SqlParameter("vuuid", Types.VARCHAR));
        declareParameter(new SqlParameter("vlimit", Types.INTEGER));

        compile();
    }

    @SuppressWarnings("unchecked")
    public List<Score> execute(String pUsername, String pUUID, int pLimit){ 
        Map<String,Object> lAllScore = super.execute(pUsername, pUUID, pLimit);
        return ((List<Score>) lAllScore.get("score")); 
    }

}

一切运行良好,但结果列表的映射出现问题。我在日志中有这一行:

INFO: Added default SqlReturnResultSet parameter named #result-set-2

但为什么 ResultSet 映射到键上#result-set-2?在这里,我将其声明为declareParameter(new SqlReturnResultSet("score", mScoreMapper));

有什么问题?RowMapper 是正确创建的...

4

1 回答 1

1

您的存储过程正在生成多个结果集。Spring 分配您尚未声明自动名称的结果集,就像您所看到的那样。在此处查看此行为的描述:https ://jira.springsource.org/browse/SPR-593?actionOrder=desc 并在http://forum.spring.io/forum/spring讨论如何处理多个结果集-projects/data/27532-jdbctemplate-missing-some-functionality

于 2013-10-13T20:42:26.387 回答