如何注释我的代码以拥有一个有 2 个地址的人:
@Entity
public Person {
// ... other attributes for a person
@OneToOne
public Address homeAddress;
@OneToOne
public Address workAddress;
}
@Entity
public Address {
// ... other attributes for an address
@OneToOne
public Person person;
}
我可以使用 OneToOne 吗?我应该在这个注释上使用选项吗?