Skip Headers

# Understanding Unique Primary Key

Previous

Next

As Figure: Variable One-to-One Relationship with Unique Primary Key illustrates, the value of the foreign key in the source table (C_ID) mapped to the primary key of the target table is unique. No primary key values among the target tables are the same, so primary key values are not unique just in the table, but also among the tables.

Variable One-to-One Relationship with Unique Primary Key

Description of "Variable One-to-One Relationship with Unique Primary Key"

If there is no indicator stored in the source table, TopLink cannot determine to which target table the foreign key value is mapped. Therefore, TopLink reads through all the target tables until it finds an entry in one of the target tables. This is an inefficient way of setting up a relation model. The class indicator is much more efficient as it reduces the number of reads performed on the tables to get the data. In the class indicator method, TopLink knows exactly which target table to look into for the data.

The principles of defining such a variable class relationship are similar to defining class indicator variable one-to-one relationships, except:

- A type indicator field is not specified.

- The class indicator values are not specified.

The type indicator field and its values are not needed, because TopLink goes through all the target tables until data is finally found.