Hello
I have a one-to-one bidirectional association, nullable.
So I made these annotations to my classes:
Code:
public class Boy {
...
@OneToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@JoinColumn(name="G_oid", referencedColumnName="oid", nullable=true)
private Girl girl;
...
}
public class Girl {
...
@OneToOne(mappedBy = "girl", cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
private Boy boy;
...
}
So I'm creating a girl and setting a boy for her that was already persisted, long time ago, in other session. When I persist the girl she goes to database but G_oid is not set. I thought that it would be updated. Am I doing something wrong?
Thank you