from SQL Server since a stored procedure has to return the cursor/resultset as an explicitly declared ref-cursor
(SQL Server, Sybase, DB2, Derby以及MySQL) 参数返回一个 ref-cursor实例。 reader.setRowMapper(new weatherEntityRowMapper()); reader.setRefCursorPosition(1);//第二种类型需要指定ref-cursor
存储过程有三种返回游标的方式: 作为一个 ResultSet 返回(SQL Server, Sybase, DB2, Derby 以及 MySQL支持) 作为一个 out 参数返回 ref-cursor 如果存储过程返回一个ref-cursor(方式2),那么我们就需要提供返回的ref-cursor(out 参数)的位置。 下面的示例中,第一个参数是返回的ref-cursor: <bean id="reader" class="o.s.batch.item.database.StoredProcedureItemReader 第一个是 out 参数,用来返回 <em>ref-cursor</em>, 第二第三个参数是 in 型参数, 类型都是 INTEGER : <bean id="reader" class="o.s.batch.item.database.StoredProcedureItemReader