Column 'view_count' cannot be null
来源:11-5 电子书快照收集脚本编写-2

weixin_慕娘4446816
2021-11-29
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);依旧报错 。 求解决
写回答
2回答
-
rarukuchaser
2023-11-17
不用那么麻烦的,sql改写成:
update doc set view_count = ifnull(view_count, 0) + 1 where id = #{id}
就好
00 -
甲蛙
2021-11-29
ebook表也有view_count字段,创建ebook时也setViewCount(0)试试
00
相似问题