垚淼 发表于 2012-10-24 23:28:53

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';
页: [1]
查看完整版本: Hibernate 查询数据异常