String call="{call test()}";
List<Map<String, Object>> result=jdbcTemplate.execute(call, new CallableStatementCallback() {
@Override
public Object doInCallableStatement(CallableStatement cs)
throws SQLException, DataAccessException {
List<Map<String, Object>> resultsMap = new ArrayList<Map<String, Object>>();
//cs.setString(1, "%张%");
cs.execute();
ResultSet rs = (ResultSet) cs.getObject(2);// 获取游标一行的值
while (rs.next()) {// 转换每行的返回值到Map中
Map<String, Object> rowMap = new HashMap<String, Object>();
rowMap.put("id", rs.getString("id"));
rowMap.put("name", rs.getString("name"));
resultsMap.add(rowMap);
}
rs.close();
return resultsMap;
}
});
List<Map<String, Object>> result=jdbcTemplate.execute(call, new CallableStatementCallback() {
@Override
public Object doInCallableStatement(CallableStatement cs)
throws SQLException, DataAccessException {
List<Map<String, Object>> resultsMap = new ArrayList<Map<String, Object>>();
//cs.setString(1, "%张%");
cs.execute();
ResultSet rs = (ResultSet) cs.getObject(2);// 获取游标一行的值
while (rs.next()) {// 转换每行的返回值到Map中
Map<String, Object> rowMap = new HashMap<String, Object>();
rowMap.put("id", rs.getString("id"));
rowMap.put("name", rs.getString("name"));
resultsMap.add(rowMap);
}
rs.close();
return resultsMap;
}
});