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

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基本上同时。

我想朋友们免费统计
原文地址:https://www.cnblogs.com/blfshiye/p/4560265.html