Hibernate Note Note

Source: Internet
Author: User

@Id Identifying primary Key properties

1.hibernate5.2 mysql5.7 need not implement Serializable also can?

2. The length of the primary key 255 I generated?

@GeneratedValue primary Key generation policy

1. The primary key is set to a string type, and @generatedvalue (Strategy=generationtype.auto) is set so that it can generate tables, but it generates two tables, one of which is a series table, but cannot be manually assigned. There is a string as the primary key does not use @column (length=8) to set the length, the actual measurement does not limit the length, but the database overhead is a bit larger, but also can be implemented to build the table?

2.auto is the primary key is automatically controlled by the program, identity is the primary key self-growth?

[Email protected], I set to auto, he newly built a list structure of table ...?

@Embeddable Embedded class attributes, added to the header of the embedded class

1. When talking about attribute-level @embeddable annotations, it is not possible to annotate @embedded annotations in reference properties, so why use @embedded annotations?

@EmbeddedId Embedded primary key class implement composite primary key (federated primary key?)

[email protected] labeled on the attribute header, @Embeddable labeled to the composite primary key class header

2. The embedded primary key class must implement the serialization interface and must contain the default public parameterless construction method, which must override the Equals and Hashcode methods

@Transient represents a mapping to a field that is not a database table, the ORM framework ignores the attribute (the ORM framework defaults to a property of @basic)

===================== Association Map ========================

Inter-entity mapping relationships

One-off: a citizen a Social security number

One-to-many (many-to-one): Multiple bank accounts for a citizen

Many-to-many: A student has multiple teachers, a teacher has multiple students

Refer to another article: Hibernate Association map annotations

Hibernate Note Note

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.