开发者

JPA 2.0 BI directional one-to-one mapping merge

I am using JPA 2 with hibernate as the vendor. I have 2 entities, Group and GroupFilter. I have a one-to-one bidirectional mapping between them with a join column in GroupFilter referencing Group. While saving Group, the GroupFilter gets persisted. However, when i try to update Group using merge, i get - org.hibernate.TransientObjectException: object references an unsaved transient instance

While persisting group, 开发者_如何转开发i need to set both relations explicitly. Using the mappedBy attribute on Group, the order of save is that Group gets persisted 1st, and then GroupFilter. But in the case of merge, i think it happens the other way around. (cascade = ALL).

Any suggestions on this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜