码迷,mamicode.com
首页 > 移动开发 > 详细

atitit. orm mapping cfg 映射配置(3)-------hbnt one2maney cfg

时间:2014-07-30 20:45:54      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   os   io   数据   

atitit. orm mapping cfg  映射配置(3)-------hbnt one2maney  cfg

 

1. 建立list 1

2. 配置xml 1

3. HibernateSetList的配置 1

4. Bag(结合了ListSet), 2

 

1. 建立list

/**

 * 集合属性只能以接口声明。例如在下面的代码中,schools的类型只能是List,不能是ArrayList,但该集合属性必须使用实现类完成初始化.

 */

public List list=new ArrayList();

 

2. 配置xml

    <!-- o7o ati -->

         <!-- many开头的是代表该表持有外键 -->      

          <!-- key是外键 -->    <!--     list是有序集合,因此持久化类到数据库时必须增加一列来表示集合元素的次序

          。list元素要求list-index的子元素来映射有序集合的次序列..jieg order col must in table def..

          yaosi b tigon column,,zeu def sh "idx"

             list_order int not null,

          -->  

<list name="list" >

<key column="programme_id"/><list-index column="play_order"></list-index>

<one-to-many class="com.focustar.programme.entity.GvProgrammeDetail"/>

</list>

 

作者:: 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://blog.csdn.net/attilax

 

3. HibernateSetList的配置

(2010-11-16 14:11:57)

转载▼

标签:

it

分类:学习总结

· Set映射:

<set name="addrs" table="EMAIL"> 

<key column="C_ID" />

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

</set>

· List映射:

<list name="addrs" table="EMAIL">

<key column="C_ID" />

<index column="LISTINDEX">(與Set映射的一點區別在於List有一個描述下標的字段)

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

</list>

 com.microsoft.sqlserver.jdbc.SQLServerException: 列名 ‘idx‘ 无效。

 

 

4. Bag(结合了ListSet),

可以重复且没有顺序的一种集合,是Hibernate提供的。HIbernate使用jdk的List模拟Bag。其配置与Hibernate映射List时基本相同。 

bubuko.com,布布扣

atitit. orm mapping cfg 映射配置(3)-------hbnt one2maney cfg,布布扣,bubuko.com

atitit. orm mapping cfg 映射配置(3)-------hbnt one2maney cfg

标签:style   blog   http   color   使用   os   io   数据   

原文地址:http://blog.csdn.net/attilax/article/details/38305919

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!