Hibernate Set Or List

送分小仙女□ 提交于 2019-12-10 12:34:54

问题


Can anybody know when to use Set and when to use List in hibernate mapping file ?

<set name="" table="">
    <key>
        <column name="" />
    </key>
</set>


<list name="" cascade="all">
    <key column="" />
    <index column="" />
    <one-to-many class=""/>
</list>

Thanks.


回答1:


Take a look at this post: @OneToMany List<> vs Set<> difference

The main difference is that a list has ordering while a set does not. Also, a set cannot have duplicate values, while a list can.



来源:https://stackoverflow.com/questions/9188718/hibernate-set-or-list

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!