Description
Liu, Yinwei David opened SPR-7506 and commented
Hi,
Here is a bug in JdbcTemplate which cannot get data from StoredProc by using column alias.
To reproduce the issue:
#1 Create a sybase stored proc:
CREATE PROCEDURE dbo.sp_test_column_alias
AS
BEGIN
select id as test_id, title as test_name from movies
END
#2 Run java code below
String sql = "sp_test_column_alias";
ResultSet rs = ((ResultSetWrappingSqlRowSet) jdbc.queryForRowSet(sql)).getResultSet();
rs.next();
System.out.println(rs.getString("test_name"));
#3 we will get an exception Invalid column name , it should use column label to get data instead of column name according to the method: ResultSet.getString(String columnLabel)
The issue is that Spring JDBCTemplate internal uses com.sun.rowset.CachedRowSetImpl to hold all data from a sp query, however, it fail to use label to get data.
David
Affects: 3.0.4