A foreign key relationship is a relationship between an extended column in any
application database table and the YFS_PERSON_INFO table. You can create foreign key elements to
establish relationship between an extended column and the YFS_PERSON_INFO table.
About this task
Note: Currently, the YFS_PERSON_INFO is the only table which
supports a relationship with foreign key extensions within the application
database.
To add foreign key elements to a standard table:
Procedure
- Copy the install_dir/repository/entity/extensions/Extensions.xml.sample
file as install_dir/extensions/global/entities/your_filename.xml
file OR modify your existing extension XML file.
- Edit the your_filename.xml file to add
foreign key elements as shown in the following example for each table
you want to extend. For a description of the XML attributes, see the
table that follows the example.
<!-- element exposed to create foreign key relationship -->
<DBSchema>
<Entities>
<Entity TableName="REQUIRED">
.
.
<!-- element exposed to create relationship with PERSON_INFO table -->
<ForeignKeys>
<ForeignKey ParentTableName="YFS_PERSON_INFO"
XMLName="YFSName1" >
<Attribute ColumnName="REQUIRED"
ParentColumnName="PERSON_INFO_KEY" />
</ForeignKey>
<ForeignKey ParentTableName="YFS_PERSON_INFO"
XMLName="YFSName2" >
<Attribute ColumnName="REQUIRED"
ParentColumnName="PERSON_INFO_KEY" />
</ForeignKey>
.
.
</ForeignKeys>
.
.
</Entity>
</Entities>
</DBSchema>
Attribute
|
Description
|
Entity
|
TableName
|
Required. Name of the table for which the foreign
key elements are added. For example: YFS_ITEM.
|
Entity/ForeignKeys/ForeignKey
|
ParentTableName
|
The name of the parent table for this foreign
key element.
Note: This value must be YFS_PERSON_INFO
which is the only table that currently supports foreign key relationships.
|
XMLName
|
You can specify the XML representation of the
element name. It must start with the prefix of the parent entity.
For example, if ParentTableName is prefixed with YFS then the XMlName
must start with YFS.
By default the parent table name is assumed.
|
Entity/ForeignKeys/ForeignKey/Attribute
|
ColumnName
|
Specifies the extended column name of the Entity.
|
ParentColumnName
|
The column name of the YFS_PERSON_INFO that
has a foreign key element relationship.
|
- Create a new ForeignKey tag for each foreign key relationship
you want to add.
- Multiple foreign key elements can be related to the same
parent table.
- Extend the corresponding API templates to include the foreign
key elements by following the instructions in Extending API Templates.
- Build and deploy your extensions.