@Id identifies the primary key attribute
1. Hibernate5.2 and mysql5.7 do not need to implement serializable?
2. I generated the length of the primary key 255?
@GeneratedValue primary key generation strategy
1. The primary key is set to string type, and @GeneratedValue(strategy=GenerationType.AUTO) can generate a table, but two tables will be generated, one of which is a sequence table, but it cannot be manually assigned, and That is, string is used as the primary key and 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, so it is possible to build a table?
2.auto means that the primary key is automatically controlled by the program, and identity is the self-growth of the primary key?
3. @GenerateValue, I set it to auto, he created a new table with a linked list structure...?
@Embeddable embedded class attribute, added to the header of the embedded class
1. When talking about the @Embeddable annotation at the attribute level, it is also possible to not mark the @Embedded annotation in the reference attribute, so why use the @Embedded annotation?
@EmbeddedId embedded primary key class implements composite primary key (joint primary key?)
1. @EmbeddedId is marked on the property header, @Embeddable is marked on the composite primary key class header
2. The embedded primary key class must implement the serialization interface, must contain the default public no-argument constructor, and must override the equals and hashcode methods
@Transient means that it is not a mapping to a field of a database table, and the ORM framework will ignore this attribute (the ORM framework defaults to an attribute as @BASIC)
======================Associative Mapping==========================
Mapping relationship between entities
One-to-one: One ID number per citizen
One-to-many (many-to-one): one citizen has multiple bank accounts
Many-to-many: one student has multiple teachers, and one teacher has multiple students
Refer to another article: hibernate association mapping annotation