Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Configuring Interface Alias

An interface alias allows an interface to be used to refer to a descriptor instead of the implementation class. This can be useful for classes that have public interface and the applications desire to refer to the class using the public interface. Specifying the interface alias allows any queries executed on a TopLink session to use the interface as the reference class instead of the implementation class.

This section includes information on configuring an interface alias. Interfaces cannot be created in TopLink Workbench, you must add the Java package or class to your TopLink Workbench project before configuring it.

Using TopLink Workbench

Use the Interface Alias tab to specify a descriptor's alias. Each descriptor can have one interface alias. Use the interface in queries and relationship mappings.


Note:

If you use an interface alias, do not associate an interface descriptor with the interface.

To specify an interface alias, use this procedure:

  1. In the Navigator, select a descriptor.

    If the Interface Alias advanced property is not visible for the descriptor, right-click the descriptor and choose Select Advanced Properties > Interface Alias from context menu or from the Selected menu.

  2. Click the Interface Alias tab.

    Figure 29-4 Interface Alias Tab

    This illustration shows the Interface Alias tab.

In the Interface Alias field, click Browse and select an interface.

Using Java

To configure a descriptor with an interface alias using Java, create an amendment method (see "Configuring Amendment Methods") and use InterfacePolicy method addParentInterface as Example 29-7 shows.

Example 29-7 Configuring an Interface Alias

public static void addToDescriptor(Descriptor descriptor)
{
    descriptor.getInterfacePolicy().addParentInterface(MyInterface.class);
}