我在 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 是正确创建的...