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'