浅析Hibernate映射(五)——集合映射

集合映射主要包括:set、list、array、map的映射

对象模型:

映射后的关系模型:

映射文件:

 

[html]  view plain copy print ?
 
  1. <hibernate-mapping>  
  2.     <class name="com.jialin.hibernate.CollectionMapping" table="t_collection_mapping">  
  3.         <id name="id">  
  4.             <generator class="native"/>  
  5.         </id>  
  6.         <property name="name"/>  
  7.         <set name="setValues" table="t_set_values">  
  8.             <key column="set_id"/>  
  9.             <element type="string" column="set_value" not-null="true"/>  
  10.         </set>  
  11.         <list name="listValues" table="t_list_values">  
  12.             <key column="list_id"/>  
  13.             <list-index column="list_index"/>  
  14.             <element type="string" column="list_value"/>  
  15.         </list>  
  16.         <array name="arrayValues" table="t_array_values">  
  17.              <key column="array_id"/>  
  18.              <list-index column="array_index"/>  
  19.              <element type="string" column="array_value"/>  
  20.         </array>  
  21.         <map name="mapValues" table="t_map_values">  
  22.             <key column="map_id"/>  
  23.             <map-key type="string" column="map_key"/>  
  24.             <element type="string" column="map_value"/>  
  25.         </map>  
  26.     </class>  
  27. </hibernate-mapping>  
posted on 2015-05-21 17:10 天使之爱你 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/niuchunjian/p/4520236.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值