JDBCTEMPLATE 调用db2存储过程异常
异常信息java.lang.IllegalArgumentException:Nostatementspecifiedatorg.springframework.util...
异常信息
java.lang.IllegalArgumentException: No statement specified
at org.springframework.util.Assert.notNull(Assert.java:90)
at org.springframework.jdbc.datasource.DataSourceUtils.applyTransactionTimeout(DataSourceUtils.java:206)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:803)
at workbench.apps.cc.functions.dataTrans.batch.CustTransService.transAcCustToClNew(CustTransService.java:99)
at workbench.apps.cc.functions.dataTrans.batch.CustTransJobTask.transCust(CustTransJobTask.java:32)
at workbench.apps.cc.functions.dataTrans.batch.CustTransJobTask.run(CustTransJobTask.java:14)
方法如下
HashMap returnMap = (HashMap) this.getJdbcTemplate().execute(
new CallableStatementCreator() {
public CallableStatement createCallableStatement(
Connection con) throws SQLException {
String storedProc = "{call " + procedureName
+ "(?,?,?,?,?)}";// 调用的sql
CallableStatement cs = con.prepareCall(storedProc);
cs.setDate(1, new java.sql.Date(DateUtils.getBusinessDate(DataTransConstants.CASETYPEID).getTime()));// 设置输入参数的值
cs.registerOutParameter(1, Types.INTEGER);
cs.registerOutParameter(2, Types.INTEGER);
cs.registerOutParameter(3, Types.INTEGER);
cs.registerOutParameter(4, Types.INTEGER);
return cs;
}
public CallableStatement createCallableStatement(
java.sql.Connection arg0) throws SQLException {
return null;
}
}, new CallableStatementCallback() {
public Object doInCallableStatement(CallableStatement cs)
throws SQLException, DataAccessException {
cs.execute();
HashMap rtMap = new HashMap();
rtMap.put("errorCode", new Integer(cs.getInt(1)));
rtMap.put("needDeal", new Integer(cs.getInt(2)));
rtMap.put("DealedTotal", new Integer(cs.getInt(3)));
rtMap.put("failedTotal", new Integer(cs.getInt(4)));
return rtMap;// 获取输出参数的值
}
});
HashMap returnMap = (HashMap) this.getJdbcTemplate().execute(
就是个事务报错,一直没找到原因 展开
java.lang.IllegalArgumentException: No statement specified
at org.springframework.util.Assert.notNull(Assert.java:90)
at org.springframework.jdbc.datasource.DataSourceUtils.applyTransactionTimeout(DataSourceUtils.java:206)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:803)
at workbench.apps.cc.functions.dataTrans.batch.CustTransService.transAcCustToClNew(CustTransService.java:99)
at workbench.apps.cc.functions.dataTrans.batch.CustTransJobTask.transCust(CustTransJobTask.java:32)
at workbench.apps.cc.functions.dataTrans.batch.CustTransJobTask.run(CustTransJobTask.java:14)
方法如下
HashMap returnMap = (HashMap) this.getJdbcTemplate().execute(
new CallableStatementCreator() {
public CallableStatement createCallableStatement(
Connection con) throws SQLException {
String storedProc = "{call " + procedureName
+ "(?,?,?,?,?)}";// 调用的sql
CallableStatement cs = con.prepareCall(storedProc);
cs.setDate(1, new java.sql.Date(DateUtils.getBusinessDate(DataTransConstants.CASETYPEID).getTime()));// 设置输入参数的值
cs.registerOutParameter(1, Types.INTEGER);
cs.registerOutParameter(2, Types.INTEGER);
cs.registerOutParameter(3, Types.INTEGER);
cs.registerOutParameter(4, Types.INTEGER);
return cs;
}
public CallableStatement createCallableStatement(
java.sql.Connection arg0) throws SQLException {
return null;
}
}, new CallableStatementCallback() {
public Object doInCallableStatement(CallableStatement cs)
throws SQLException, DataAccessException {
cs.execute();
HashMap rtMap = new HashMap();
rtMap.put("errorCode", new Integer(cs.getInt(1)));
rtMap.put("needDeal", new Integer(cs.getInt(2)));
rtMap.put("DealedTotal", new Integer(cs.getInt(3)));
rtMap.put("failedTotal", new Integer(cs.getInt(4)));
return rtMap;// 获取输出参数的值
}
});
HashMap returnMap = (HashMap) this.getJdbcTemplate().execute(
就是个事务报错,一直没找到原因 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询