I\'m using Spring with Hibernate as a JPA provider and are trying to get a @OneToMany (a contact having many phonenumbers) to save the foreign key in the phone numbers table
@Entity
public class Contact {
@Id
private Long id;
@JoinColumn(name = "contactId")
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
private Set phones;
}
@Entity
public class Phone {
@Id
private Long id;
private Long contactId;
}