Hi Guys,
I am new to JPA and i have a question about the OneTOMany unidirectional mapping. Let we assume the following example two entities
Person (ID, NAME) and Car (ID, CAR_NAME, PER_ID) i.e the foreign key is in the target table.
Here is my relationship mapping inside the Person entity;
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "CAR",
joinColumns = @JoinColumn(name = "PER_ID"),
inverseJoinColumns = @JoinColumn(name = "ID"))
private List<Car> cars;
Note this is an unidirectional OneToMany mapping from Person to Car. I am using Eclipselink and the above mapping is always not working . Sometimes system throws the exception and says CAR_ID is not found.
If any of you came similar issue please share your idea. Much appreciate your reply.
Regards t