请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

Column 'view_count' cannot be null

Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘view_count’ cannot be null

The error may exist in file [D:\zhishi\target\classes\mapper\EbookSnapshotMapperCust.xml]

The error may involve defaultParameterMap

The error occurred while setting parameters

Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘view_count’ cannot be null

在Docservice中 doc.setViewCount(0);
doc.setVoteCount(0);依旧报错 。 求解决

正在回答 回答被采纳积分+3

2回答

rarukuchaser 2023-11-17 14:13:31

不用那么麻烦的,sql改写成:

update doc set view_count = ifnull(view_count, 0) + 1 where id = #{id}

就好

0 回复 有任何疑惑可以回复我~
甲蛙 2021-11-29 16:05:13

ebook表也有view_count字段,创建ebook时也setViewCount(0)试试

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号