Skip to content

Instantly share code, notes, and snippets.

@adilkurniaramdan
Created May 8, 2013 08:20
Show Gist options
  • Save adilkurniaramdan/5539021 to your computer and use it in GitHub Desktop.
Save adilkurniaramdan/5539021 to your computer and use it in GitHub Desktop.
//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