休眠设置或列表 [英] Hibernate Set Or List

查看:108
本文介绍了休眠设置或列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以知道什么时候使用Set以及何时在Hibernate映射文件中使用List?

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.

推荐答案

看看这篇文章: @OneToMany List<> vs Set<>差异

主要区别在于列表有排序,而排序不排列。另外,一个集合不能有重复值,而列表可以。

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.

这篇关于休眠设置或列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆