Difference between @OneToMany and @ElementCollection?

前端 未结 6 1465
不思量自难忘°
不思量自难忘° 2020-11-28 02:19

What is the difference between using a @OneToMany and @ElementCollection annotation since both work on the one-to-many relationship?

6条回答
  •  忘掉有多难
    2020-11-28 03:10

    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.

提交回复
热议问题