Issue
What is the difference between using a @OneToMany
and @ElementCollection
annotation since both work on the one-to-many relationship?
Solution
I believe @ElementCollection
is mainly for mapping non-entities (embeddable or basic) while @OneToMany
is used to map entities. So which one to use depend on what you want to achieve.
Answered By - MrKiane
Answer Checked By - Clifford M. (JavaFixing Volunteer)