Hitachi

uCosminexus Application Server Compatibility Guide


8.12.54 @SecondaryTable

Organization of this subsection

(1) Description

This annotation specifies the secondary table in the entity class.

This annotation is specified when the entity class is mapped in multiple tables of the database.

When @SecondaryTable is not specified within the entity class, all persistence properties or persistence fields of the entity class will be mapped to the tables specified in the primary table.

The applicable target is class.

(2) Element

The following table lists the elements of @SecondaryTable:

Element name

Optional/Required

Element description

name

Required

This element specifies the secondary table name.

catalog

Optional

This element specifies the catalog name of the secondary table.

Note that Cosminexus JPA provider does not support this attribute.

schema

Optional

This element specifies the schema name of the secondary table.

pkJoinColumns

Optional

This element specifies the external key column used to bind the secondary table to the primary table.

uniqueConstraints

Optional

This element specifies the unique key constraints in 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 secondary table name.

The table name that can be specified depends on the database specifications.

Default value

None

(b) schema element

Type

String

Description

This element specifies the schema name of the secondary table.

The schema name that can be specified depends on the database specifications.

Default value

Default schema name of the database used

(c) pkJoinColumns element

Type

PrimaryKeyJoinColumn[]

Description

This element specifies the external key column of the secondary table. This annotation is specified in the arrays of @PrimaryKeyJoinColumn.

When this element is not specified, the external key column of the secondary table has the same name and type as the primary key column of the primary table. Therefore, the secondary table references the primary key column of the primary table.

Default value

You can specify the value within the specifiable range of the arrays of @PrimaryKeyJoinColumn. For details, see 8.12.51 @PrimaryKeyJoinColumn.