First page Back Continue Last page Graphics

Creating a Subtype Entity Object


Creating a Subtype Entity Object

To create a subtype entity object, use the Create Entity Object wizard as follows:

1. Provide a name and package, and then click Browse to select a parent entity for the subtype entity to extend. The example in the slide shows how to create the Employees EO to extend the Persons entity.

2. Add attributes from the underlying table that are specific to this entity subtype by clicking “New from Table.” Then click Override to override the discriminator attribute. The example adds a new attribute, Salary, from the database table, and overrides the PersonTypeCode attribute.

3. Set a value for the discriminator attribute that is appropriate for this subtype. The example sets the value for PersonTypeCode to STAFF.

4. Generate a Java class for the subtype if you want to override a method in the base entity or add a method that is specific only to this subtype. This example does not show methods.

In the example, an additional subtype, Customers, is created, and extends the Persons entity. It adds the new attribute CreditLimit from the database table and overrides the PersonTypeCode attribute from the parent entity. It then sets the discriminator attribute’s value to CUST.