当柳上原的风吹向天际的时候...

真正的快乐来源于创造

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  368 Posts :: 1 Stories :: 201 Comments :: 0 Trackbacks
           this.getJdbcTemplate().execute(
                
new CallableStatementCreator() {
                    
public CallableStatement createCallableStatement(Connection con) throws SQLException {
                        String storedProc 
= "{call updatetractractcode(?, ?)}";// 调用的存储过程
                        CallableStatement cs = con.prepareCall(storedProc);
                        cs.setInt(
1, contractId);// 设置输入参数的值
                        cs.registerOutParameter(2, java.sql.Types.INTEGER);// 注册输出参数的类型
                        return cs;
                    }
                }, 
new CallableStatementCallback() {
                    
public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
                        cs.execute();
                        
return cs.getString(2);// 获取输出参数的值
                }
            });
posted on 2011-06-02 09:05 何杨 阅读(1129) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: