First page Back Continue Last page Text

oracle adf workshop


Using Inheritance in the Business Domain Layer (continued)

You can set up a base entity called PersonEO. Remove all the attributes that pertain only to customers, such as creditLimit, or to employees, such as hireDate, from it. You can then define additional entities called CustomerEO and EmployeeEO that extend PersonEO, and add their specific attributes and methods.

When you create an EO to use in this type of inheritance hierarchy, you must indicate which column in the table is used to distinguish the type of row it is. This column is known as the discriminator column; in the example of the Persons table, this is the PERSON_TYPE column. You must also assign a default value to that discriminator attribute (optional in the base class).