How to identify the mapped/owned sides of a self-referencing one-to-one relationship in Hibernate?
问题 My Hibernate schema has a Port entity. Each Port should have zero or one connections to another Port so there is a "connectedPort" field referencing the same entity: public class Port { // ... @OneToOne @JoinColumn private Port connectedPort; // ... } But normally for a @OneToOne there would be an "owned" side of the relationship and a "mapped" side of the relationship - is this also the case here - and if so, how and why? 回答1: From the OneToOne API doc: If the relationship is bidirectional,