Možná budete chtít mít v tabulce vztahů dva sloupce,
@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;