Skip to content
Advertisement

Stored Procedure returning multiple tables to spring jdbc template

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.

If I use jdbcTemplate.queryForList(myStoredProc, new Object[]{parameters} iam getting only first table from the result.

My database is SQL Server 2005.

Is there any method other than jdbcTemplate for my requirement?

Advertisement

Answer

See http://static.springsource.org/spring/docs/2.0.7/reference/jdbc.html#jdbc-StoredProcedure

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.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement