使用ssh存儲(chǔ)過(guò)程實(shí)現(xiàn)購(gòu)物車(chē)添加和商品列表的數(shù)據(jù)減少,程序執(zhí)行成功但是數(shù)據(jù)庫(kù)數(shù)據(jù)沒(méi)變java調(diào)用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;
}
}調(diào)用mysql存儲(chǔ)過(guò)程代碼 <sql-query name="update" callable="true">
{call zcxg(?,?,?,?)} </sql-query>mysql的存儲(chǔ)過(guò)程詳細(xì)代碼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
ssh存儲(chǔ)過(guò)程無(wú)法改變數(shù)據(jù)庫(kù)數(shù)據(jù)
慕娘9325324
2018-08-24 10:09:29