Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Configuring Class Indicator

In variable one-to-one mappings, you can use an indicator column in the source table to specify the correct target table, as illustrated in Figure 41-1. This section includes information on implementing class indicators.

A source table has an indicator column that specifies the target table through the class indicator field.

Figure 41-1 illustrates the EMPLOYEE table that has a TYPE column that indicates the target for the row (either PHONE or EMAIL).

Figure 41-1 Variable One-to-One Mapping using Class indicator Field

Description of "Figure 41-1 Variable One-to-One Mapping using Class indicator Field"

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

- The reference class is a Java interface, not a Java class. However, the method to set the interface is identical.

- You must specify a type indicator field.

- You specify the class indicator values on the mapping so that mapping can determine the class of object to create.

- You must specify the foreign key names and the respective abstract query keys from the target interface descriptor.

Alternatively, you can use unique primary keys to specify the correct target. See "Configuring Unique Primary Key" for more information.

## Using TopLink Workbench

To specify the class indicators for a variable one-to-one mapping, use this procedure:

1. Select the variable one-to-one mapping in the Navigator. Its attributes appear in the Editor.

2. Click the Class Indicator Info tab. The Class Indicator Info tab appears.

   Figure 41-2 Class Indicator Info Tab

   Description of "Figure 41-2 Class Indicator Info Tab"

Use the Class Indicator Field to select the field on the database table (associated with the mapping's descriptor) to use as the indicator for the variable mapping.

Use the Indicator Type to specify the data type of the class indicator field by selecting the data type from the list.

To specify the specific class indicator field values for each (nonabstract) child class, click Edit and enter the appropriate value for each child class.