Say, I have following entities:
@Entity
public class A {
@Id
@GeneratedValue
private Long id;
@Embedded
private B b;
//getters and setters
}
@Embeddable
public class B {
@OneToMany
private List<C> cList;
//getters and setters
}
@Entity
public class C {
@Id
@GeneratedValue
private Long id;
//other fields, getters and setters
}
Using schema-autogeneration feature with Hibernate
I get an additional table which contains mappings between A
and C
. But I'd like to implement a one-to-many relationship by adding A
's id into C
(e.g without additional table).
Is this possible? If yes, what annotations should I use to create such a mapping?