hibernate 怎么调用 带返回参数的存储过程
展开全部
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public String callFirstProcedures(final long qyid, final int pdys) {
String procedureSql = "{call get_qyaqdcpdjb(?,?,?)}";
Object pj = jdbcTemplate.execute(procedureSql,
new CallableStatementCallback() {
public Object doInCallableStatement(CallableStatement cs)
throws SQLException, DataAccessException {
cs.setLong(1, qyid);
cs.setInt(2, pdys);
//你需要注册一个输出参数
cs.registerOutParameter(3, Types.VARCHAR);
cs.execute();
return cs.getString(3);
}
});
return HtmsUtils.formatObject(pj);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public String callFirstProcedures(final long qyid, final int pdys) {
String procedureSql = "{call get_qyaqdcpdjb(?,?,?)}";
Object pj = jdbcTemplate.execute(procedureSql,
new CallableStatementCallback() {
public Object doInCallableStatement(CallableStatement cs)
throws SQLException, DataAccessException {
cs.setLong(1, qyid);
cs.setInt(2, pdys);
//你需要注册一个输出参数
cs.registerOutParameter(3, Types.VARCHAR);
cs.execute();
return cs.getString(3);
}
});
return HtmsUtils.formatObject(pj);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询