What is the difference between using a @OneToMany and @ElementCollection annotation since both work on the one-to-many relationship?
@OneToMany
@ElementCollection
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.