@Entity
public class A {
@Id
@Column(name = "a_id")
private Long id;
@OneToMany(mappedBy = "a", fetch = FetchType.LAZY)
private List<B> bs;
@OneToMany(mappedBy = "a", fetch = FetchType.LAZY)
private List<C> cs;
public Long getId() {return id;}
public void setId(Long id) {this.id = id;}
public List<B> getBs() {return bs;}
public void setBs(List<B> bs) {this.bs = bs;}
public List<C> getCs() {return cs;}
public void setCs(List<C> cs) {this.cs = cs;}
}
@Entity
public class B {
@Id
@Column(name = "b_id")
private Long id;
@Column(name = "b_value")
private String value;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "a_id")
private A a;
public Long getId() {return id;}
public void setId(Long id) {this.id = id;}
public String getValue() {return value;}
public void setValue(String value) {this.value = value;}
public A getA() {return a;}
public void setA(A a) {this.a = a;}
}
@Entity
public class C {
@Id
@Column(name = "c_id")
private Long id;
@Column(name = "c_value")
private String value;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "a_id")
private A a;
public Long getId() {return id;}
public void setId(Long id) {this.id = id;}
public String getValue() {return value;}
public void setValue(String value) {this.value = value;}
public A getA() {return a;}
public void setA(A a) {this.a = a;}
}