@Entity
public class Person {
@Id
private int id;
@OneToOne(cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE}, fetch=FetchType.LAZY, mappedBy="owner")
@LazyToOne(value = LazyToOneOption.NO_PROXY)
private Pet pet;
}
@Entity
public class Pet {
@Id
private int id;
@OneToOne(fetch=FetchType.LAZY, cascade={CascadeType.MERGE, CascadeType.PERSIST})
@LazyToOne(value = LazyToOneOption.NO_PROXY)
@JoinColumn(name="owner_id")
private Person owner;
}