Date: 2005-02-02T17:03:17 Editor: MichelleCaisse Wiki: Apache JDO Wiki Page: MetadataMappings URL: http://wiki.apache.org/jdo/MetadataMappings
no comment Change Log: ------------------------------------------------------------------------------ @@ -1,3 +1,18 @@ = Inheritance = + The Company model provides two inheritance hierarchies: Person <- Employee <- FullTimeEmployee, PartTimeEmployee; and Insurance <- MedicalInsurance, DentalInsurance. + +There are three inheritance patterns possible: + *One Table - All rows in the inheritance hierarchy are stored in one table that has a superset of the required columns plus a discriminator column to specify the class of that row. + *Joined Tables - Each class, including the parent class, maps to its own table. The tables are joined by their primary keys. + *Subclass Tables - each subclass maps to a table that contains columns for both the subclass and its parent class. + +The inheritance strategies are mapped by use of the metadata elements <inheritance> and <discriminator>. The following metadata cases must be tested: + +||inheritance pattern||base class||subclasses|| +||One Table|| <inheritance strategy="new-table">|| <inheritance strategy="superclass-table">|| +||Joined Tables|| <inheritance strategy="new-table">|| <inheritance strategy="new-table">|| +||Subclass Tables|| <inheritance strategy="no-table">|| <inheritance strategy="new-table">|| + +'''Question:''' <inheritance> takes a <join> element according to the dtd. Is this used to specify the primary key in the Joined Tables pattern? If so, how is it used, syntactically?