分享

collection xml 配置

 moonboat 2009-02-11
set:An unordered collection that can't duplicate elements is called a set
<set name="images" table="ITEM_IMAGE">
 <key column="ITEM_ID" />
 <element type="string" column="FILENAME" not-null="true" />
</set>
ITEM_ID,FILENAME:PK. (because there don't permit duplicate)
ITEM_ID:FK refer owner (PK)

bag:An unordered collection that permits duplicate elements is called a bag
<bag name="items" table="user_item">
 <key column="id" />
 <element column="name" type="java.lang.String" />
</bag>
id:FK refer owner(PK)
it havs a bad performance when update,because it can't location.
ibbag:An unordered collection that permits duplicate elements is called a bag,more effect than bag,because there have another filed used to location,e.g:ITEM_IMAGE_ID
<idbag name="image_bag" table="ITEM_IMAGE_bag">
 <collection-id type="long" column="ITEM_IMAGE_ID">
  <generator class="native" />
 </collection-id>
 <key column="ITEM_ID" />
 <element type="string" column="FILENAME" not-null="true" />
</idbag>
ITEM_IMAGE_ID:PK
ITEM_ID:FK refer (owner) PK
list: An ordered collection that permits duplicate elements is called a list.
<list name="images_list" table="ITEM_IMAGE_list">
 <key column="ITEM_ID" />
 <list-index column="POSITION" />
 <element type="string" column="FILENAME" not-null="true" />
</list>
list:
item_id,position:PK
item_id:FK refter (owner) Pk
<map name="images_map" table="ITEM_IMAGE_map">
 <key column="ITEM_ID" />
 <map-key column="IMAGENAME" type="string" />
 <element type="string" column="FILENAME" not-null="true" />
</map>
Map:
ITEM_ID,IMAGENAME:PK
ITEM_ID:FK refer owner (PK)

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多