Example: Configuring the IDResolveKeys.properties file to generate cascaded primary keys

The primary table STOREENT defines a primary key STOREENT_ID. STORE, a foreign table referencing STOREENT, defines a primary key STORE_ID that is a foreign key to the primary table STOREENT. This means that the value of STORE_ID must be one of the STOREENT_ID values. STORE_ID, the primary key of the foreign table STORE, therefore has a dual role: primary and foreign.

Let us assume that another table, CONTRACT, is a foreign table on STORE and that the foreign key for CONTRACT, STORE_ID, references the primary key STORE_ID in STORE. The STORE table is therefore a primary table for the CONTRACT table.

Because the STORE table's STORE_ID is referenced from the STOREENT_ID rather than created, the idresgen utility does not create an internal-alias and ID-value association for the STORE table. When the CONTRACT table tries to resolve the STORE_ID from the STORE table, it gets the empty value.

Because of this special condition, explicitly specify the creation of the internal alias by creating an entry in the IDResolveKeys.properties file. In the IDResolveKeys.properties file, specify the following:

  "STORE=@STORE_ID:STORE_ID"

This forces the idresgen utility to:

Use the STORE=@STORE_ID:STORE_ID entry in the IDResolveKeys.properties file and the following XML input-file fragment:

  <STOREENT
    IDENTIFIER="Out Fashions"
    MEMBER_ID="-2000"
    STOREENT_ID="@storeent_id_1"
    TYPE="G"
  />
  <STORE
    STORE_ID="@storeent_id_1"
    STOREGRP_ID="1"
    STORELEVEL="store_level"
  />
  <CONTRACT
    CONTRACT_ID="@contract_id_1"
    STATE="0"
    STORE_ID="@storeent_id_1"
  />

would yield the following after resolution:

  <STOREENT
    IDENTIFIER="Out Fashions"
    MEMBER_ID="-2000"
    STOREENT_ID="10501"
    TYPE="G"
  />
  <STORE
    STORE_ID="10501"
    STOREGRP_ID="1"
    STORELEVEL="store_level"
  />
  <CONTRACT
    CONTRACT_ID="@contract_id_1"
    STATE="0"
    STORE_ID="10501"
  />

Related concepts

Related tasks

Related reference