`
shonghuanc
  • 浏览: 81585 次
文章分类
社区版块
存档分类
最新评论

hibernate调用存储过程

阅读更多
  /**
     * 手动调用计算费用
     *
     * @throws BusinessException
     */
    public String countFeeByHand(final Date startTime, final String operBizId)
            throws DataAccessException {
        String destroyFee = (String) this.getHibernateTemplate().execute(

        new HibernateCallback() {
            public Object doInHibernate(Session session)
                    throws HibernateException, SQLException {
                CallableStatement cs = session.connection().prepareCall(
                        "{call MANUAL_USER_SETTLEMENT(?,?,?,?)}");// 存储过程调用有错误
                cs.setString(1, DateTools.getYearMonthString(startTime));
                cs.setString(2, operBizId);
                cs.registerOutParameter(3, Types.INTEGER);
                cs.registerOutParameter(4, Types.CHAR);
                cs.execute();
                return cs.getString(4);
            }
        });
        return destroyFee;
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics