ObjectExtender User's Guide and Reference
A secondary table map is necessary when a persistent model
class is mapped to two or more database tables. An example of this type
of mapping can be found in the Bank sample model.
Launch the Map Browser, and select BankSample from the
Datastore Maps view, and then select VapCustomer from
the Persistent Classes view.
Note that two table maps are present for the VapCustomer
persistent class. The CUSTDATA is the secondary table
map.
It was created as follows
- In the Bank sample schema, there needs to be a CUSTDATA and
CUSTOMER table with all of the necessary columns added. It
is the CUSTDATA table that is going to hold additional information
for the VapCustomer persistent class.
- Create a foreign key relationship named custdata-customer where
CUSTOMER is the primary key table and CUSTDATA is the
foreign key table. (Recall this is done using the Schema
Browser).
- In the Map Browser, select VapCustomer.
- Create the CUSTOMER table map with no inheritance.
Note that when mapping the attributes in the Property Map Editor for this
table, the birthDate, felon, rating, and
sex will not get mapped because this table does not have the fields
necessary to map these attributes. All of the associations can be
mapped from this table.

- From the Table_Maps menu, select New Table Map - Add
Secondary Table Map.
- Select the CUSTDATA table from the Table menu.
- Select the custdata-customer relationship from the Foreign
Key Relationship list.
- Select OK.
- Select the CUSTDATA table map.
- Select Edit Property Maps from the Table Maps
menu.
- Select the corresponding table column for the class attributes:
birthDate, felon, rating, and
sex.
- Select OK.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]