Set集合-----无序,不允许有重复元素
List集合-----有序,允许有重复元素
Set
<set name="emps"> <key column="depart_id"/> <one-to-many class="Employee"/> </set> |
List
<list name="emps"> <key column="depart_id"/> <list-index column="order_id"/> <one-to-many class="Employee"/> </list> |
Bag-----无序,其它和list一样,jdk中无此类型,hibernate独有
<bag name="emps"> <key column="depart_id"/> <one-to-many class="Employee"/> </bag> |
Map
<map name="emps"> <key column="depart_id"/> //注意:类型一定是小写 <map-key type="string" column="name"/> <one-to-many class="Employee"/> </map> |
Array
<array name="emps"> <key column="depart_id"/> <list-index column="order_id"/> <one-to-many class="Employee"/> </array> |
实体bean定义的集合一定要都是接口