The Java background SSH framework hibernate experience One

Source: Internet
Author: User

Bidirectional Association and one-Way association

Two-way association: Both tables update the other table regardless of which update

One-way association: Only one master table update from the table updates the main table from the table regardless

Bidirectional affinity Configuration

Table 1 Configuration

<set name= "Object name" order-by= "ID ASC" inverse= "true" lazy= "false" >
<key>
<column name= "column name" not-null= "true"/>
</key>
<one-to-many class= "Object file name specific path"/>
</set>

Table 2 Configuration

<many-to-one name= "Object Name" class= "Object file name specific path" fetch= "select" >
<column name= "column name" not-null= "true"/>
</many-to-one>

Order-by property is sorted by

Lazy is true to indicate a lazy load, which is false for immediate loading. That is to get the object of table one at the same time the table one and table two related data are all taken out.

One-way associative configuration

Table 1 Configuration

<set name= "Object name" order-by= "ID ASC" inverse= "true" lazy= "false" >
<key>
<column name= "column name" not-null= "true"/>
</key>
<one-to-many class= "Object file name specific path"/>
</set>

Table 2 Configuration

<property name= "column name" type= "Data Type" >
<column name= "Answer" not-null= "true"/>
</property>

The Java background SSH framework hibernate experience One

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.