What is the difference between:
@Entity
public class Company {
@OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY)
@JoinColumn(name = \"c
I'd just like to add that @JoinColumn
does not always have to be related to the physical information location as this answer suggests. You can combine @JoinColumn
with @OneToMany
even if the parent table has no table data pointing to the child table.
How to define unidirectional OneToMany relationship in JPA
Unidirectional OneToMany, No Inverse ManyToOne, No Join Table
It seems to only be available in JPA 2.x+
though. It's useful for situations where you want the child class to just contain the ID of the parent, not a full on reference.