hi
Here is a very simple example for OneToMany:
Code:
@Entity
public class A {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@OneToMany(mappedBy="a",cascade=CascadeType.ALL)
private List<B> blist = new ArrayList<B>();
Code:
@Entity
public class B {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@ManyToOne
private A a;
Code:
create table A(id int not null primary key auto_increment);
create table B(
id int not null primary key auto_increment,
a_id int not null
);
repeat the similar mapping on B for C entity.
Hope this helps