问题描述:Null value was assigned to a property of primitive type setter

问题描述:Null value was assigned to a property of primitive type setter 

原因:数据库字段值为NULL,int 类型不能赋值为NULL,只能为0,但有些实际应用中,如学生分数,0表示0分,NULL,则表示暂无分数所以,要不设数据字段不为NULL,要不就是用Integer.

问题描述:Null value was assigned to a property of primitive type setter  ,hibernate int型数据无法读取 hiberante读int 整型数据出错 hiberante读数据库出错 


 解决办法:

javabean.hbm.xml

  <property name="provinceOrderMember" type="int">
            <column name="provinceOrderMember">
                <comment></comment>
            </column>
        </property>
type="int" 改为type="java.lang.Integer"

javabean

    private int provinceOrderMember; 改为private Integer provinceOrderMember

你可能感兴趣的:(null,value)