Added annotations

1. @PrimaryKeyJoinColumn will be used in three cases

inherit.

The entity class maps to one or more slave tables. The slave table creates a primary key column of the same type based on the primary key column of the primary table (the column name is the column with the referencedColumnName value), and the column name is defined by the name attribute. 

In a one2one relationship, the primary key of the relationship maintenance side is used as a foreign key to point to the primary key of the maintained side of the relationship, and a new foreign key column is no longer created.

Property description:

name: column name. referencedColumnName: The column name of the referenced column of this column

columnDefinition: defines the DDL that creates this column when creating a table

2.spring @Entity @Table

Reference: https://blog.csdn.net/u010081710/article/details/51692314

3. hibernate annotation 

Reference: https://blog.csdn.net/wangpeng047/article/details/8712752

(1) @GeneratedValue, the primary key generation strategy, the attribute in it: generator This attribute is used to give a name to the strategy

(2) @GenericGenerator, where the attribute: name specifies the generator name, strategy specifies the class name of the specific generator (specifies the generation strategy).

(4) @Column declares the mapping of attributes to columns.

(3) Several strategies contained in the value of the strategy attribute

The uuid   uses the 128-bit uuid algorithm to generate the primary key, and the uuid is encoded as a string of 32-bit hexadecimal numbers. Takes up a lot of space (string type).

The assigned  primary key is handled by the program when inserting data (very common), which is the default generation strategy when the <generator> element is not specified. Equivalent to AUTO in JPA.

E.g:

@GeneratedValue(generator = "paymentableGenerator")

       @GenericGenerator(name = "paymentableGenerator", strategy = "assigned")

(5)@Temporal

Date type declared.

TemporalType.DATE date, for example: 2011-04-12

TemporalType.TIME time, for example: 22:50:30

TemporalType.TIMESTAMP date and time, for example: 2011-04-12 22:51:30

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325812779&siteId=291194637