Hibernate 查询数据异常

Hibernate 查询数据异常

Null value was assigned to a property of primitive type setter of com.chwl.model.Content.score

原因是score字段定义为int类型,而默认值为null。

在java里int类型是不能为null的,所以把默认值设为0就可以了。

修改mysql数据库某个字段默认值的方法:
update content set score = '0';

原文地址:https://www.cnblogs.com/ljmin/p/2576980.html