Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

jpa tree structure

@Entity
@Table(name = "node")
public class Node {

    @Id
    @Column(name = "id")
    private String id;

    @Column(name = "name")
    private String name;

    @Column(name = "parent_id")
    private String parentId;

    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name = "parent_id", referencedColumnName = "id")
    private Set<Node> childNodes;
}
 
PREVIOUS NEXT
Tagged: #jpa #tree #structure
ADD COMMENT
Topic
Name
9+9 =