Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

jpa tree structure

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

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

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

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "parent_id", referencedColumnName = "id")
    private Node parentNode;

    @OneToMany(fetch = FetchType.EAGER, mappedBy = "parentNode")
    private Set<Node> childNodes;
}
Comment

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;
}
Comment

PREVIOUS NEXT
Code Example
Java :: Java get list of keys Hashmap 
Java :: go to activity android 
Java :: list java processes 
Java :: android java date from internet 
Java :: java swing jtable zebra stripes 
Java :: set drawableleft programmatically android 
Java :: spring data rest format date 
Java :: immagini java 
Java :: java print type of object 
Java :: closest fraction to pi 
Java :: date from string java 
Java :: how to compare 3 numbers in java 
Java :: system.out.write in java example 
Java :: concurrent modification exception 
Java :: java import set and hashset 
Java :: Which of the following is the only Java package that is imported by default? 
Java :: check type of variable java 
Java :: java button 
Java :: java switch 
Java :: creating modulu function withou using % java 
Java :: get value textfield java 
Java :: java coding standards variables 
Java :: how to get only current date in java android studio 
Java :: java how to override a private method 
Java :: find if a value is in a 2d array java 
Java :: procedural programming Java code example 
Java :: How to perform counting sort in Java? 
Java :: check character is alphanumeric java 
Java :: java scanner input float 
Java :: android studio set text of textview 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =