リレーションシップテーブルに2つの列が必要な場合があります
@ManyToOne(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
@JoinTable(name="Relationship", joinColumns = @JoinTable(name = "Relationship", joinColumns = @JoinColumn(name = "parent_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "id", referencedColumnName = "id"))@Fetch(FetchMode.SELECT)
private Node parentNode;
@OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
@JoinTable(name = "Relationship", joinColumns = @JoinColumn(name = "id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "parent_id", referencedColumnName = "id"))
@Fetch(FetchMode.SELECT)
private Set<Node> childNodes;