I am looking into creating a class in such a way that it can hold references to itself and a parent. In other words, I am looking to make a bi-directional tree of these classes.
The class would like something like this:
@Entity @Table(name="sample") public class Sample { private String id; private Sample parent; private Set<Sample> children; @Id @Column(name="id"); public String getId(){ return id; } public void setId(String id) { this.id=id; } /** This is where I am confussed.... **/ }
varchar(256) id varchar(256) parentId