错误:org.hibernate.PropertyValueException:not-null property references a null or transient value解决方案

org.hibernate.PropertyValueException: not-null property references a null or transient value: com.zyj.test.Card.cardnum

提示很明显,非空的值关联了一个空值或无效的值,就是你数据库里面某个字段设置为非空了,

在.hbm.xml文件里某个属性的not-null=“true” 该为 false 或者将其去除
例如:

 <property name="sname" type="java.lang.String">
    <column name="sname" not-null="false" />
    </property>`

猜你喜欢

转载自blog.csdn.net/qq_40697892/article/details/84059928