2.7.21 @Id

Organization of this subsection
(1) Description
(2) Element

(1) Description

This annotation specifies the properties or fields of the primary key of entity class.

@Id is applicable in the entity class or mapped superclass.

The column of the database mapped to the field or property in which @Id is specified is assumed as the primary key column of the primary table. When the column name of the primary key column is not specified using @Column, the column name of the primary key column becomes the name of the field or property in which @Id is specified.

Note that if @Version is specified in a field in which @Id is specified, @Id becomes invalid.

The applicable targets are method and field.

(2) Element

@Id does not have attributes.