Skip Headers
Oracle® Application Server TopLink Mapping Workbench User's Guide
10g Release 2 (10.1.2)
Part No. B15900-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
 

Implementing Inheritance

Inheritance describes how a child class inherits the characteristics of its parent class. TopLink uses multiple implementations to support database inheritance.

In the advanced tutorial, the LargeProject and SmallProject classes inherit the characteristics of the BaseProject class. Use the following procedures to set the BaseProject descriptor to implement inheritance, then enable the two subclasses.

To implement inheritance in the BaseProject descriptor:

  1. Click the BaseProject descriptor in the Navigator pane.

  2. Click the Inheritance tab in the Editor pane.

    If the Inheritance tab is not visible, right-click the Project descriptor and choose Advanced Properties >  Inheritance from the pop-up menu or Selected >  Advanced Properties >  Inheritance from the menu.

  3. Ensure that the Is Root Descriptor field is selected.

  4. Select the Use Class Indicator Field option, and use the drop-down list to choose PROJ_TYPE.

  5. Select the Use Class Indicator Dictionary field and choose a String type as the Indicator Type.

To implement inheritance in each subclass:

  1. Click the SmallProject descriptor in the Navigator pane.

  2. Click the Inheritance tab in the Editor pane.

    If the Inheritance tab is not visible, right-click the SmallProject descriptor and choose Advanced Properties >  Inheritance from the pop-up menu or Selected >  Advanced Properties >  Inheritance from the menu.

  3. In the Parent Descriptor drop-down list, choose the BaseProject class.

  4. Save button.
    Description of the illustration savebtn.gif

    Click Save on the toolbar or choose File  >  Save Project to save the project.

Repeat this procedure for the LargeProject descriptor.

To complete the inheritance:

  1. Click the BaseProject descriptor in the Navigator pane.

  2. Click the Inheritance tab in the Editor pane.

  3. Select the Read Sublcasses on Query option.

  4. For each inherited descriptor:

    • Select the Include column.

    • Click Edit.

    • Enter an Indicator Value (S for SmallProject and L for LargeProject) for each child class.

Figure B-42 Inheritance Tab

Description of inhertn.gif follows
Description of the illustration inhertn.gif


Note:

To have the root class store instances of itself in the table, it must include a value-subclass pair for itself. This is not required for the advanced tutorial because Project is an abstract class.