org.hibernate.TransientObjectException: object references an unsaved transient instance - save the t

芃蓉蓁蓁發表於2020-09-29

報錯:org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.hp.pms.project.entity.Project

解決辦法:將many-to-one的級聯設為: cascade="save-update,persist"或cascade=“all”

<many-to-one name="group" column="groupid" cascade="save-update,persist"></many-to-one>

參考博文:https://blog.csdn.net/sdyy321/article/details/5984226;
https://blog.csdn.net/u012159094/article/details/26073679

相關文章