Have a relation between a sub table and a related table using the primary table. Any thoughts about how to go about the hibernate relation.
A <---> B (One to One relation) B is a sub-table of A.
B <---> C (B has One to Many Relation with C Using A)
Have a relation between a sub table and a related table using the primary table. Any thoughts about how to go about the hibernate relation.
A <---> B (One to One relation) B is a sub-table of A.
B <---> C (B has One to Many Relation with C Using A)
It not needed in table B in your case. There is @OneToMany between A and B.
@Entity
@Table(name="A")
public class A {
....
@OneToMany(mappedBy="a")
private B b;
}
@Entity
@Table(name="C")
public class C {
...
@OneToOne
@JoinColume(name="ref_to_a")
private A a;
}
Additional table B is required if @ManyToMany association take place.