2.7.51 @PrimaryKeyJoinColumn

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

(1) Description

This annotation specifies the column used as the external key when binding with another table. This annotation is used in the following cases:

The applicable targets are class, method, and field.

(2) Element

The following table lists the elements of @PrimaryKeyJoinColumn:

Element nameOptional/RequiredElement description
nameOptionalThis element specifies the column name for binding the target tables.
referencedColumnNameOptionalThis element specifies the column name of the primary key of binding--destination table that is referenced by the column specified in the name element.
columnDefinitionOptionalThis element is used to describe the constraints added to the column in the DDL, when the CREATE statement is output.
Note that Cosminexus JPA provider does not support this attribute.

The details of attributes that are supported with Cosminexus JPA provider are as follows:

(a) name element
Type
String
Description
This element specifies the column name for binding the target tables.
The column name that can be specified depends on the database specifications.
Default value
  • When the JOINED strategy is used
    Column name of the primary key of primary table of the superclass
  • When @SecondaryTable is used
    Column name of the primary key of primary table
  • When the OneToOne relationship is used
    Column name of the primary key of target entity table
(b) referencedColumnName element
Type
String
Description
This element specifies the column name of the primary key of binding-destination table that is referenced by the column specified in the name element. Specify the same value as the character string of the name element of @Column. Arrange the upper case and lower case characters in the character string to be specified.
The column name that can be specified depends on the database specifications.
Even when the unique key constraints are used instead of specifying the primary key in the column in the OneToOne relationship, the operation will continue, but will not be guaranteed.
Default value
  • When the JOINED strategy is used
    Column name of the primary key of primary table of the superclass
  • When @SecondaryTable is used
    Column name of the primary key of primary table
  • When the OneToOne relationship is used
    Column name of the primary key of target entity table