我是Spring的新手,我现在正在学习它。与此同时,我被困在一个特定的地方。我能够执行存储过程,但它没有返回给我任何结果。请指导我。我正在使用sybase数据库。存储过程包含两个参数,一个用于输入,另一个是输出。
public String getGetNextIdQuery(String string, String region){
String custId = "";
JdbcTemplate jtempl = jdbcTemplateMap.get(region);
Map<String, Object> inParams = new HashMap<String, Object>();
String nextId = "?";
inParams.put("len", string);
inParams.put("acct_id",nextId);
SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(jtempl).
withProcedureName("pr_acct_id")
.withReturnValue()
.withReturnValue().withoutProcedureColumnMetaDataAccess()
.declareParameters(new SqlOutParameter("RETURN", java.sql.Types.VARCHAR))
.declareParameters(new SqlParameter("len", java.sql.Types.SMALLINT))
.declareParameters(new SqlParameter("acct_id", java.sql.Types.VARCHAR))
.declareParameters(new SqlReturnResultSet("RESULT", new ResultSetExtractor<String>() {
@Override
public String extractData(
ResultSet arg0)
throws SQLException {
String custId = "";
int i = 0;
while(arg0.next()) {
System.out.println(i++);
custId = arg0.getString("acct_id");
}
return custId;
}
}));
Map<String, Object> result = simpleJdbcCall.execute(inParams);
System.out.println((String)result.get("RESULT"));
custId = (String)result.get("RESULT");
return custId;
}