Atitit. orm mapping cfg ing configuration (3) ------- hbnt one2maney cfg, atititorm

Source: Internet
Author: User

Atitit. orm mapping cfg ing configuration (3) ------- hbnt one2maney cfg, atititorm

Atitit. orm mapping cfg ing configuration (3) ------- hbnt one2maney cfg

 

1. Create list 1

2. Configure xml 1

3. Set and List configuration in Hibernate 1

4. Bag (combined with List and Set), 2

 

1. Create a list

/**

* Set attributes can only be declared using interfaces. For example, in the following code, the schools type can only be List, not ArrayList, but the set attribute must be initialized using the implementation class.

*/

Public List list = new ArrayList ();

 

2. Configure xml

<! -- O7o ati -->

<! -- Begin indicates that the table holds a foreign key. -->

<! -- Key is a foreign key --> <! -- List is an ordered set. Therefore, a column must be added to the persistence class to indicate the order of the Set elements.

. The list element requires that the sub-element of list-index map the sub-sequence of the ordered set... 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-learn class = "com. focustar. programme. entity. GvProgrammeDetail"/>

</List>

 

Author: old wow's paw Attilax iron, EMAIL: 1466519819@qq.com

Reprinted please indicate Source: http://blog.csdn.net/attilax

 

3. Set and List configuration in Hibernate

(14:11:57)

Reprinted token

It

Category: Learning Summary

· Set ing:

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

<Key column = "C_ID"/>

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

</Set>

· List ing:

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

<Key column = "C_ID"/>

<Index column = "LISTINDEX">)

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

</List>

Com. microsoft. sqlserver. jdbc. SQLServerException: the column name 'idx' is invalid.

 

 

4. Bag (combining List and Set ),

A set that can be repeated and has no sequence. It is provided by Hibernate. HIbernate uses the jdk List to simulate the Bag. Its configuration is basically the same as that of Hibernate List ing List.


When I use hibernate to write the hibing file hibernatecfgxml, where should the hibernate-mapping-30dtd be imported?

<? Xml version = "1.0" encoding = "UTF-8"?>

<! DOCTYPE hibernate-mapping PUBLIC "-// Hibernate/Hibernate Mapping DTD 3.0 // EN" "hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

Spring + hibernate, configure mapping in hibernatecfgxml to report an error

Von_pneumonia is good. It must be a packet problem.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.