hibernate4.x 报错org.hibernate.TransientPropertyValueException: Not-null property references a

来源:互联网 发布:风火轮打单软件 编辑:程序博客网 时间:2024/05/21 22:38

1 错误描述:

hibernate4.x创建多对一关系报错
org.hibernate.TransientPropertyValueException: Not-null property references a transient value - transient instance must be saved before current operation: cn.com.pojo.n21.both.notPK.Order.customer
这里写图片描述

2 可能原因之一级解决方法:

xx.hbm.xml文件设置多对一关系many-to-one时候column设置了not-null=”true”约束
这里写图片描述

注:xx.hbm.xml文件设置多对一关系many-to-one时候column不能加not-null=”true”和unique=”true”约束

xx.hbm.xml文件设置多对一关系many-to-one时候column设置了 unique=”true”约束报错

ERROR: Duplicate entry '102' for key 'UK_590egrftni5wpw63w6fcc1atx'
阅读全文
0 0
原创粉丝点击