Hibernate XML format and anno format Mappedby

Source: Internet
Author: User

XML configuration of more than one by one to many foreign keys can be configured the same, but Anno not very good, more this is finished, one side with a Mappedby "" in the other side of the property "on it, or to build an intermediate table. XML Mappedby because the foreign key has been configured, just to determine whether to maintain the relationship. Two-way Association is the correspondence, one is the object of a party with one, and the second one has a set of more than one party. Once the relationship is not maintained by oneself, then one party sets a set of more than one set to its own set, but many of the parties do not save their own objects, so that a save, more than the other side of the foreign key is not related to the primary key of one party, but not more tables or something, Do not want to annotation remove mappedby after the build more tables.

In fact, the XML configuration, one side of the configuration of a set out, just for hibernate to know how to parse the corresponding relationship, the storage and reading can find the database data and object properties of the corresponding, or only a party get one side, not one party get many side.

Hibernate XML format and anno format Mappedby

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.