Hello, there.
How can I set OneToMany relationship in JPA, when child's identity(uniqueness) needs parent's primary key?
Every books that I have only talk about the @PrimaryKeyJoinColumn with OneToOne mapping.
Every books that I have only talk about the @OneToMany mapping with non-identifying relationships.
Every google pages has no exception.
@Entity public class Parent implements Serializable {
@Id public int id;
@OneToMany public Collection<Child> child;
}
@Entity public class Child implements Serializable {
@Id public int child_id;
@ManyToOne Parent parent; // NOT FK, BUT PK ?????????????
}