第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

ssh存儲過程無法改變數(shù)據庫數(shù)據

ssh存儲過程無法改變數(shù)據庫數(shù)據

慕娘9325324 2018-08-24 10:09:29
使用ssh存儲過程實現(xiàn)購物車添加和商品列表的數(shù)據減少,程序執(zhí)行成功但是數(shù)據庫數(shù)據沒變java調用public int add(int sid,int num,double total,int uid) {        try {            this.getSession().getNamedQuery("update").setParameter(0, sid).setParameter(1, num)             .setParameter(2, total).setParameter(3, uid);            return 1;         } catch (Exception e) {            // TODO: handle exception            e.printStackTrace();            return 0;         }     }調用mysql存儲過程代碼 <sql-query name="update" callable="true">         {call zcxg(?,?,?,?)}    </sql-query>mysql的存儲過程詳細代碼create procedure `zcxg`(in sid int,in num int,in total double,in uid int)beginupdate shop as s set s.`number`=(s.`number`-`num`) where s.`id`=`sid`;insert into cart(number,sid,total,uid) values(`num`,`sid`,`total`,`uid`);commit;end
查看完整描述

1 回答

?
慕斯王

TA貢獻1864條經驗 獲得超2個贊

  this.getSession().getNamedQuery("update").setParameter(0, sid).setParameter(1, num)
            .setParameter(2, total).setParameter(3, uid);

換成

    String procdure = "{call cl(?,?,?,?)}";
            CallableStatement cs = this.getHibernateTemplate().getSessionFactory().getCurrentSession().connection().prepareCall(procdure);
            cs.setInt(1, sid);
            cs.setInt(2, num);
            cs.setDouble(3, total);
            cs.setInt(4, uid);
            cs.execute();


查看完整回答
反對 回復 2018-09-12
  • 1 回答
  • 0 關注
  • 807 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號