If the relationship is bidirectional, the non-owning side must use the mappedBy element of the OneToOne annotation to specify the relationship field or property of the owning side.

So, either your connectedPort has no relationship to its reverse connected port and the holder of the field connectedPort has the foreign key, or the relationship is bi-directional and you have to specify who holds the foreign key using mappedBy.

Edit As I assume from your code snippet your connected ports have no knowledge of who is connected to them, so your Port holding the knowledge to whom they are connected hold the foreign key and are the owning side of this relationship.

Email codedump link for How to identify the mapped/owned sides of a self-referencing one-to-one relationship in Hibernate?