@Entity public class Troop { @OneToMany(mappedBy="troop") public Set<Soldier> getSoldiers() { ... } @Entity public class Soldier { @ManyToOne() @JoinColumn(name="troop_fk") public Troop getTroop() { ... }
References
https://stackoverflow.com/questions/11938253/jpa-joincolumn-vs-mappedby
https://stackoverflow.com/questions/37047938/jpa-hibernate-onetoone-joincolumn-referencedcolumnname-ignored