SSH结合,循环插入数据库时,为什么先insert一条语句,后面就update了,id是主键,auto_increment
for(inti=0;i<bookSum.length;i++){order.setUserName(userName);order.setAddress(address...
for(int i=0;i<bookSum.length;i++){
order.setUserName(userName);
order.setAddress(address);
order.setDate(stamp1);
order.setBookName(bookName[i]);
order.setBookPrice(bookPrice[i]);
order.setAccount(account[i]);
order.setBookSum(bookSum[i]);
iOrderManager.addOrder(order);
}
下面是插入语句:
Hibernate: insert into bookstore.t_order (userName, bookName, bookPrice, account, bookSum, date, address) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: update bookstore.t_order set userName=?, bookName=?, bookPrice=?, account=?, bookSum=?, date=?, address=? where orderId=?
Hibernate: update bookstore.t_order set userName=?, bookName=?, bookPrice=?, account=?, bookSum=?, date=?, address=? where orderId=? 展开
order.setUserName(userName);
order.setAddress(address);
order.setDate(stamp1);
order.setBookName(bookName[i]);
order.setBookPrice(bookPrice[i]);
order.setAccount(account[i]);
order.setBookSum(bookSum[i]);
iOrderManager.addOrder(order);
}
下面是插入语句:
Hibernate: insert into bookstore.t_order (userName, bookName, bookPrice, account, bookSum, date, address) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: update bookstore.t_order set userName=?, bookName=?, bookPrice=?, account=?, bookSum=?, date=?, address=? where orderId=?
Hibernate: update bookstore.t_order set userName=?, bookName=?, bookPrice=?, account=?, bookSum=?, date=?, address=? where orderId=? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询