Created
May 8, 2013 08:20
-
-
Save adilkurniaramdan/5539021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Desa.Java | |
@Entity | |
@Table(name="desa") | |
public class Desa { | |
@Id @Column(name="ID") | |
private int id; | |
@Id @Column(name="NAME") | |
private String name; | |
@OneToMany(fetch = FetchType.EAGER, mappedBy = "desa") | |
private Set<Clan> clans = new HashSet<Clan>(); | |
//setter getter are hidden.. | |
} | |
//Clan.java | |
@Entity | |
@Table(name="clan") | |
public class Clan { | |
@Id @Column(name="ID") | |
private int id; | |
@Id @Column(name="NAME") | |
private String name; | |
@ManyToOne(cascade = CascadeType.ALL) | |
private Desa desa; | |
@OneToMany(fetch = FetchType.EAGER, mappedBy = "clan") | |
private Set<Shinoby> shinobies = new HashSet<Shinoby>(); | |
//setter getter are hidden | |
} | |
//Shinoby.java | |
@Entity | |
@Table(name="shinoby") | |
public class Shinoby { | |
@Id @Column(name="ID") | |
private int id; | |
@Id @Column(name="NAME") | |
private String name; | |
@ManyToOne(cascade=CascadeType.ALL) | |
private Clan clan; | |
@OneToMany(fetch = FetchType.EAGER, mappedBy = "shinoby") | |
private Set<Jutsu> jutsus = new HashSet<Jutsu>(); | |
//setter getter are hidden.. | |
} | |
//Jutsu.java | |
@Entity | |
@Table(name="jutsu") | |
public class Jutsu { | |
@Id @Column(name="ID") | |
private int id; | |
@Id @Column(name="NAME") | |
private String name; | |
@ManyToOne(cascade=CascadeType.ALL) | |
private Shinoby shinoby; | |
//setter getter are hidden | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment