2.7.26 @JoinTable

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

(1) Description

This annotation specifies the binding table set up in the following classes:

When the name element is not specified, the name of the binding table becomes as follows:

owner-table--name_non--owner-table-name

The applicable targets are method and field.

(2) Element

The following table lists the elements of @JoinTable:

Element nameOptional/RequiredElement description
nameOptionalThis element specifies the name of the binding table.
catalogOptionalThis element specifies the catalog name of the binding table.
Note that Cosminexus JPA provider does not support this attribute.
schemaOptionalThis element specifies the schema name of the binding table.
joinColumnsOptionalThis element specifies the external key column of the binding table that references the primary table of the owner entity.
inverseJoinColumnsOptionalThis element specifies the external key column of the binding table that references the primary table of the non--owner entity.
uniqueConstraintsOptionalThis element specifies the unique constraints of the table.
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 name of the binding table.
The table name that can be specified depends on the database specifications.
Default value
owner-table-name_non-owner-table-name
(b) schema element
Type
String
Description
This element specifies the schema name of the table.
The value that can be specified depends on the specifications of the database schema name.
Default value
Default schema of the database used
(c) joinColumns element
Type
JoinColumn[]
Description
This element specifies the external key column of the binding table that references the primary table of the owner entity. This element specifies an array of @JoinColumn. The external key column name of the binding table is specified in the name element, while the referenced column name of the owner is specified in the referencedColumnName element of @JoinColumn.
The column names that can be specified depend on the database specifications.
Default value
External key of @JoinColumn
(d) inverseJoinColumns element
Type
JoinColumn[]
Description
This element specifies the external key column of the binding table that references the primary table of the non--owner entity. This element specifies an array of @JoinColumn. The external key column name of the binding table is specified in the name element, while the column of the binding--destination table that is referenced by the external key column is specified in the referencedColumnName element of @JoinColumn.
The values that can be specified depend on the specifications of the database column name.
Default value
External key column of @JoinColumn