Hibernate link notes and hibernate link notes

Source: Internet
Author: User

Hibernate link notes and hibernate link notes

HibernateLink notes

  • Unidirectional N: 1

* Joined table: Use <join>/<join-to-one> on the N side. You do not need to configure the associated persistence class.

* No join table: Use <sequence-to-one> on the N side. You do not need to configure the associated persistence class.

  • Unidirectional 1: N

* Connected table: Use <set>/<sequence-to-sequence> On the first side, and set the unique attribute to true in sequence-to-sequence. Nparty does not need to configure the associated persistence class.

* No join table: Use <set>/<one-to-sequence> On the first side. Nparty does not need to configure the associated persistence class.

Note: cascadeIn <set>Configure on

  • Bidirectional 1: N

* Connected table: the first party uses <set>/<sequence-to-sequence> and sets the unique parameter of <sequence-to-sequence> to true. Nparty uses <join>/<allow-to-one>

* No join table: the first party uses <set>/<one-to-sequence>. N-Party <role-to-one>

Note: Only 1Use inverseGive up control, NThe party cannot give up control because there is no inverseAttribute.

  • Unidirectional N: N

The control end uses <set>/<allow-to-operate>

  • Bidirectional N: N

Both sides use <set>/<relative-to-sequence>

  • Unidirectional

* Foreign key-based: the console uses <role-to-one> and sets the unique attribute of <role-to-one> to true.

* Based on the primary key: the control end sets the ID generation policy to foreign and uses the <one-to-one> label.

* Connection-based table: the control end uses <join>/<join-to-one> and sets the unique attribute of <join-to-one> to true.

  • Bidirectional 1:1

* Foreign key-based: one Party uses <sequence-to-one> and sets its unique parameter to true. The other party uses <one-to-one>

* Based on the primary key: one Party sets the ID generation policy to foreign and uses the <one-to-one> label. The other uses only the <one-to-one> label.

* Based on the connection table: <join>/<join-to-one> is used on both sides. Set the <key> unique attribute under <join> and the unique attribute of <join-to-one> to true. The inverse parameter must be set to true on both sides to give up control.

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.