@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "children",
joinColumns = @JoinColumn(name = "parent_id"),
inverseJoinColumns = @JoinColumn(name = "child1_id", insertable = false, updatable = false)
)
@WhereJoinTable(clause = "child1_id is not null")
private List<Child1Entity> children1 = new ArrayList<Child1Entity>();
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "children",
joinColumns = @JoinColumn(name = "parent_id"),
inverseJoinColumns = @JoinColumn(name = "child2_id", insertable = false, updatable = false)
)
@WhereJoinTable(clause = "child2_id is not null")
private List<Child2Entity> children2 = new ArrayList<Child2Entity>();