其它映射 set list map array

Posted on 2009-08-23 13:57  哥德巴赫猜  阅读(165)  评论(0)    收藏  举报

set

list

array

map

t_CollectionMapping

id

name

1

xxx

 

t_set_values

set_id

set_value

1

a

1

b

 

t_list_value

list_id

list_value

list_index

1

c

0

1

d

1

 

t_array_value

array_id

array_value

array_index

1

e

0

1

f

1

 

t_map_value

map_id

map_key

map_value

1

k1

v1

1

k2

v2

 

CollectionMapping.hbm.xml

<class name="com.bjsxt.hibernate.CollectionMapping" table="t_collection_mapping">

       <id name="id">

           <generator class="native"></generator>

       </id>

       <property name="name"></property>

       <set name="setValue" table="t_set">

           <key column="set_id"></key>

           <element type="string" column="set_value"></element>

       </set>

       <list name="listValue" table="t_list">

           <key column="list_id"></key>

           <list-index column="list_index"></list-index>

           <element type="string" column="list_value"></element>

       </list>

       <array name="arrayValue" table="t_array">

           <key column="array_id"></key>

           <list-index column="array_index"></list-index>

           <element type="string" column="array_value"></element>

       </array>

       <map name="mapValue" table="t_map">

           <key column="map_id"></key>

           <map-key type="string" column="map_key"></map-key>

           <element type="string" column="map_value"></element>

       </map>

  </class>  

 

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3