@OneToMany和@ElementCollection之间的区别? [英] Difference between @OneToMany and @ElementCollection?
本文介绍了@OneToMany和@ElementCollection之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 @OneToMany
和 @ElementCollection
注释有什么区别,因为两者都是在one-to -many relationship?
解决方案
我相信 @ElementCollection
非实体(可嵌入或基本),而 @OneToMany
用于映射实体。那么使用哪一个取决于你想要达到的目标。
What is the difference between using a @OneToMany
and @ElementCollection
annotation since both work on the one-to-many relationship?
解决方案
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.
这篇关于@OneToMany和@ElementCollection之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文