Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘click_co
Error updating database.Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘click_count’ cannot be null今天写代码的时候,在页面提交表单一直不成功,查看后台发现报sql语句错误,提示属性不能为空。一开始以为是我mapper.xml里面的sql语句写错了,后来又以为是页面
·
Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘click_count’ cannot be null
今天写代码的时候,在页面提交表单一直不成功,查看后台发现报sql语句错误,提示属性不能为空。
一开始以为是我mapper.xml里面的sql语句写错了,后来又以为是页面调用的id名和数据库里的不一致,最后经过很长时间的检查,才发现是我的方法调用错了,GoodsServiceImpl里面应该调用insertSelective方法而不是insert方法,我一开始调用的是insert方法,两者的区别是insertSelective是有选择性的插入,而insert是全部插入,然而有些数据表单没有,所以会报为null
更多推荐
所有评论(0)