db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Watzek <mwa.t...@spree.de>
Subject Inheritance proposal
Date Mon, 08 Aug 2005 15:24:14 GMT
Hi,

in t-conference, Jul 8, Craig proposed 5 inheritance mappings that TCK 
should implement. Below, you find a description of each mapping.

All mappings are based on the company model. The company model defines 
two inheritance hierarchies:

               Person                            Insurance
                  |                              /        \
              Employee                DentalInsurance  MedicalInsurance
              /       \
FullTimeEmployee   PartTimeEmployee

The proposal is to define a separate schema and separate ORM metadata 
for each mapping. Each mapping below specifies the ORM inheritance 
strategy for each class. Note, that the first mapping (Mapping 0) is 
already implemented by TCK:

- Mapping 0 (implemented by TCK):
The same table for all classes in the inheritance hierarchy. That table 
specifies a discriminator column, identiying the actual type of each row.
Person and Insurance have inheritance strategy "new-table". Tables of 
these classes have dicriminator columns.
All other classes have inheritance strategy "superclass-table".

- Mapping 1:
Separate table for each class in the inheritance hierarchy. Each table 
contains columns for the declared fields. There are no discriminator 
columns. Instead, there are FKs from subclass tables to superclass 
tables. The ORM metadata specifies nested <join> elements for all 
subclasses. All classes have inheritance strategy "new-table".

- Mapping 2:
Separate table for each class in the inheritance hierarchy. No tables 
for abstract classes Employee and Insurance. Each table contains columns 
for all fields including fields of superclasses.
There are no FKs from subclass tables to superclass tables. The ORM 
metadata does not specifies nested <join> elements. There are no 
discriminator columns.
All classes have inheritance strategy "new-table".
Some additional constraints: Managers, mentors, hradvisors, and 
employees of the month are fulltime employees. Only fulltime employees 
can have insurances, can be project members, and can be project 
reviewers. Separate phone number type tables for persons, fulltime 
employees, and parttime employees.

- Mapping 3:
Person has inheritance strategy "new-table.
Employee has inheritance strategy "subclass-table".
PartTimeEmployee and FullTimeEmployee have inheritance strategy 
"new-table".
Insurance has inheritance strategy "subclass-table".
MedicalInsurance and DentalInsurance have inheritance strategy "new-table".
The ORM metadata specifies nested <join> elements for classes 
PartTimeEmployee and FullTimeEmployee. Tables of these classes have FKs 
to table of class Person. There are no discriminator columns.

- Mapping 4:
Person, Employee, and Insurance have inheritance strategy "new-table". 
PartTimeEmployee, FullTimeEmployee, MedicalInsurance, and 
DentalInsurance have inheritance strategy "superclass-table".
The ORM metadata specifies a nested <join> element for class Employee. 
The table of class Employee has a FK to the table of class Person.
The tables of classes Employee and Insurance have discriminator columns.

Attached you find schema files for each mapping. All attached schema 
files implement application identity. Note, that I did not attach the 
schema for "Mapping 0", as you find that in your workspace.

Please review and comment!

Regards,
Michael
-- 
-------------------------------------------------------------------
Michael Watzek                  Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de        Buelowstr. 66
Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
Fax.:  ++49/30/217 520 12       http://www.spree.de/
-------------------------------------------------------------------

Mime
View raw message