Hibernate provides three ways to turn Pojo into a PO class:
1. Use persistent annotations (which are based on JPA standard annotations and, if there are some special requirements, you still need to use the annotations provided by Hibernate itself).
2. Use the XML configuration profile (XML deployment descriptor) provided by JPA2, which allows Hibernate's PO class to be compatible with JPA entity classes.
3. Use Hibernate's traditional XML mapping file (in the form of a *.hbm.xml file).
For Hibernate PO classes, it is usually possible to decorate it with the following two annotations:
1. @Entity: The Pojo that is modified by the annotation is an entity. When you use this annotation, you can specify a Name property that specifies the names of the entity classes. By default, the class name of the class is the names of the entity classes.
2. @Table: The note specifies a table for persisting class lock mappings.
@Table annotations can specify the properties:
1. Catalog: (not required) to set the table that will be mapped by the persistence class into the established catalog. If this attribute is not specified, the data table is placed in the default catalog.
2. Indexs: (not required) set the index for the table mapped by the persistence class. The property value is an array of @index annotations.
3. Name: (not required) set the table name of the table to which the persistence class is mapped. If this attribute is not developed, the table name is the same as the class name of the persisted class.
4. Schema: (not required) set the table mapped by the persistence class into the specified schema. If this attribute is not specified, the data table is placed in the default schema.
5. Uniqueconstraints: (not required) set a UNIQUE constraint for the table mapped by the persistence class. The value of this property is an array of @uniqueconstraint annotations.
@UniqueConstraint used to define a unique constraint on a data table. Use this annotation to specify a unique property: ColumnNames. The value of ColumnNames is an array of strings, each of which represents a data column.
@Index used for data table definition indexes. Use this annotation to specify properties such as Columnlist, name, unique, and so on.
1.columnList
2. Name
3. Unique
3. @Access
Accesstype.property
Accesstype.field
4. @Proxy
5. @DynamicInsert: Specifies whether INSERT statements for entry and exit records are dynamically generated at run time, and only those non-empty fields are inserted. The value of this property is false by default. Turning on this property will cause hibernate to need more time to survive the SQL statement.
6. @DynamicUpdate: Specifies whether the UPDATE statement for updating records is dynamically generated at run time and updates only those fields that have changed. The value of this property is false by default. Turning on this property will cause hibernate to take more time to generate the SQL statement.
La La la
5--Basic usage of Hibernate--6 deep hibernate mapping