Interface descriptors are defined only with query keys that are shared among their implementors. In the descriptor for the interface, only the name of the query key is specified.
In each implementor descriptor, the key must be defined, and with appropriate field, from one of the implementor descriptor's tables.
Doing this ensures that a single query key can be used to specify foreign key information from a descriptor that contains a mapping to the interface, even if the field names differ.
Consider an Employee that contains a contact, of type Contact. Contact is an interface with two implementors: Phone and EmailAddress. Each class has two attributes. The following figure illustrates the generated keys:
Figure 4-29 Auto-generated Query Keys for Phone and Email
 
Figure 4-30 Contact interface Descriptor with Common Query Key id
 
Now that a descriptor with a commonly shared query key has been defined for Contact, you can use it as the reference class for a variable one-to-one mapping. For example, you can now create a one-to-one mapping for the contact attribute of Employee. When you edit the foreign key field information for the mapping, you must match the Employee descriptor's tables to query keys from the Contact interface descriptor.
See "Working with Interfaces" and "Working with Java Object Relationship Mappings" for more information.
Copyright © 1997, 2004, Oracle. All rights reserved.