存储过程将多个表返回到spring jdbc模板 [英] Stored Procedure returning multiple tables to spring jdbc template
问题描述
Iam使用JdbcTemplate从我的Spring DAO类调用存储过程。我的问题是,存储过程返回多个表。有没有办法使用Spring JdbcTemplate访问多个表。
Iam calling a stored procedure from my Spring DAO class using JdbcTemplate. My problem is that, stored procedure returns multiple tables. Is there a way to access multiple tables using Spring JdbcTemplate.
如果我使用
jdbcTemplate.queryForList(myStoredProc,new Object [] {parameters}
我只从结果中获取第一个表。
If I use
jdbcTemplate.queryForList(myStoredProc, new Object[]{parameters}
iam getting only first table from the result.
我的数据库是SQL Server 2005。
My database is SQL Server 2005.
我的要求是否有除jdbcTemplate以外的任何方法。如果是,请告诉我。
Is there any method other than jdbcTemplate for my requirement. If yes, please let me know.
提前致谢....
Thanks in advance....
推荐答案
参见 http://static.springsource.org/spring/docs/2.0.7/reference /jdbc.html#jdbc-StoredProcedure
本节中给出的示例完全适用于存储过程返回多个结果集的情况。给出了适用于Oracle的示例,但它也应该以相同的方式为MS SQL Server工作。
The example given in this section is exactly for your case where the stored procedure returns multiple result-sets. Although the example given there is for Oracle, but it should work in the same way for MS SQL Server also.
这篇关于存储过程将多个表返回到spring jdbc模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!