1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
@Entity
@Table(name = "ENT_D")
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
public class EntD implements Serializable {
@Id
@GeneratedValue(generator = "hibseq")
@GenericGenerator(name = "hibseq", strategy = "seqhilo", parameters = { @Parameter(name = "max_lo", value = "1"),
@Parameter(name = "sequence", value = "SEQ_ENT_D") })
@Type(type = "com.projet.perso.usertype.SequenceString")
@Column(name = "D_ID")
private Long dId;
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "D_ID", nullable = true)
@ForeignKey(name = "FK_ENT_C_ENT_D")
private Set<EntC> entC;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "D_ID", nullable = true)
@ForeignKey(name = "FK_ENT_A_ENT_D")
private Set<EntA> entA;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entD")
@ForeignKey(name = "FK_ENT_B_ENT_D")
private Set<EntB> entB;
}
@Entity
@Table(name = "ENT_C")
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
public class EntC implements Serializable {
@Id
@GeneratedValue(generator = "hibseq")
@GenericGenerator(name = "hibseq", strategy = "seqhilo", parameters = { @Parameter(name = "max_lo", value = "1"),
@Parameter(name = "sequence", value = "SEQ_ENT_C") })
@Type(type = "com.projet.perso.usertype.SequenceString")
@Column(name = "C_ID")
private Long cId;
@ManyToOne
@JoinColumn(name = "D_ID", nullable = false)
@ForeignKey(name = "FK_ENT_C_ENT_D")
private EntD entD;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entC")
@ForeignKey(name = "FK_ENT_B_ENT_C")
private Set<EntB> entB;
}
@Entity
@Table(name = "ENT_A")
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
public class EntA implements Serializable {
@Id
@GeneratedValue(generator = "hibseq")
@GenericGenerator(name = "hibseq", strategy = "seqhilo", parameters = { @Parameter(name = "max_lo", value = "1"),
@Parameter(name = "sequence", value = "SEQ_ENT_A") })
@Type(type = "com.projet.perso.usertype.SequenceString")
@Column(name = "A_ID")
private Long aId;
@ManyToOne
@JoinColumn(name = "D_ID", nullable = false)
@ForeignKey(name = "FK_ENT_A_ENT_D")
private EntD entD;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entA")
@ForeignKey(name = "FK_ENT_B_ENT_A")
private Set<EntB> entB;
}
@Entity
@Table(name = "ENT_B")
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
public class EntB implements Serializable {
@Id
@GeneratedValue(generator = "hibseq")
@GenericGenerator(name = "hibseq", strategy = "seqhilo", parameters = { @Parameter(name = "max_lo", value = "1"),
@Parameter(name = "sequence", value = "SEQ_ENT_B") })
@Column(name = "A_ID")
private Long bId;
@ManyToOne
@JoinColumn(name = "D_ID")
private EntD entD;
@ManyToOne
@JoinColumn(name = "C_ID")
private EntC entC;
@ManyToOne
@JoinColumn(name = "A_ID")
private EntA entA;
} |
Partager