新增产品失败,rowcount=0

来源:8-9 商品管理模块所有功能自测

主打情歌

2018-06-13

http://127.0.0.1:8088/manage/product/save.do?categoryId=1&name=三星洗衣机&subtitle=三星大促销&subImages=test.jpg&detail=detailtext&price=1000&stock=100&status=1&id=3

返回的结果是更新产品失败。

日志


[15:03:23.204][DEBUG][org.mybatis.spring.SqlSessionUtils][http-nio-8088-exec-5] Creating a new SqlSession

[15:03:23.205][DEBUG][org.mybatis.spring.SqlSessionUtils][http-nio-8088-exec-5] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1ad4a03c] was not registered for synchronization because synchronization is not active

[15:03:23.205][DEBUG][o.m.s.t.SpringManagedTransaction][http-nio-8088-exec-5] JDBC Connection [jdbc:mysql://127.0.0.1:3306/mmall_learning?characterEncoding=utf-8, UserName=root@localhost, MySQL-AB JDBC Driver] will not be managed by Spring

[15:03:23.206][DEBUG][c.m.dao.ProductMapper.updateByPrimaryKey][http-nio-8088-exec-5] ==>  Preparing: update mmall_product set category_id = ?, name = ?, subtitle = ?, main_image = ?, sub_images = ?, detail = ?, price = ?, stock = ?, status = ?, create_time = ?, update_time = now() where id = ? 

[15:03:23.208][DEBUG][c.m.dao.ProductMapper.updateByPrimaryKey][http-nio-8088-exec-5] ==> Parameters: 1(Integer), 三星洗衣机(String), 三星大促销(String), test.jpg(String), test.jpg(String), detailtext(String), 1000(BigDecimal), 100(Integer), 1(Integer), null, 3(Integer)

[15:03:23.209][DEBUG][c.m.dao.ProductMapper.updateByPrimaryKey][http-nio-8088-exec-5] <==    Updates: 0

[15:03:23.210][DEBUG][org.mybatis.spring.SqlSessionUtils][http-nio-8088-exec-5] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1ad4a03c]

Product{id=3, categoryId=1, name='三星洗衣机', subtitle='三星大促销', mainImage='test.jpg', subImages='test.jpg', detail='detailtext', price=1000, stock=100, status=1, createTime=null, updateTime=null}


写回答

3回答

polo哦

2018-06-13

看看你的product的id是不是真的存在吧,可能找不到对应的product

0
3
Geely
回复
主打情歌
赞,同学,好细心,解决了就好~~
2018-06-17
共3条回复

qq_黑男_04384141

2019-05-23

我的是新增失败


0
0

qq_黑男_04384141

2019-05-23

我也是跟你一样的问题,怎么解决呀


0
0

从0开始 独立完成企业级Java电商网站服务端开发

前后端分离,数据库接口设计,架构设计,功能开发,上线运维

9476 学习 · 8804 问题

查看课程