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?
精彩评论