Skip Headers

# Variable One-to-One Mapping

Previous

Next

Variable class relationships are similar to polymorphic relationships, except that in this case the target classes are not related through inheritance (and thus not good candidates for an abstract table), but through an interface.

To define variable class relationships in TopLink Workbench, use the variable one-to-one mapping selection, but choose the interface as the reference class. This makes the mapping a variable one-to-one. When defining mappings in Java code, use the `VariableOneToOneMapping` class.

TopLink supports variable relationships only in one-to-one mappings. It handles this relationship in two ways:

- Through the class indicator field (see "Configuring Class Indicator").

- Through unique primary key values among target classes implementing the interface (see "Configuring Unique Primary Key").

Variable One-to-One Mappings with Class Indicator

Description of "Variable One-to-One Mappings with Class Indicator"

See "Configuring a Relational Variable One-to-One Mapping" for more information.