Specifies that the fields defined on the type are stored in a separate table in the underlying relational database system.
dbo in Microsoft SQL Server) is used.
<JoinedInheritance> element specifies the extent provider of the type. Joined inheritance stores the additional fields of the type in the specified table of the underlying relational database system. The table is stored in the provided catalog with the database-user.
When the extent of the type is queried, Genome joins the table to the extent of the base type. The table contains a copy of the identity fields of the base extent. These identity fields are handled by Genome , so no extra care is needed to manage them.
|
|
#1 and #2 are instances of T0
and object #3 is an instance of T)
Using joined inheritance should be considered when queries in the application are rarely executed against the base type of the type or when the fields of base type do not usually participate in the filter criteria. In the case of such queries performed against the type, Genome only uses tables with fields referenced from the OQL expressions.
The fields of Supplier are stored in the TBL_SUPPLIER table.
BusinessContact.cs
public abstract class BusinessContact : Persistent {
public abstract int Id { get; set }
public abstract string CompanyName { get; set }
...
}
public abstract class Supplier : BusinessContact {
public abstract string HomePage { get; set; }
...
}
NorthwindSchema.xml
<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">
...
<Type name="BusinessContact">
<RootInheritance />
...
<Member name="Id" PersistentField="Id" />
<Member name="CompanyName" PersistentField="Name" />
</Type>
<Type name="Supplier">
<JoinedInheritance tableName="TBL_SUPPLIER" />
<!-- <JoinedInheritance /> would store the homepage in the "Supplier" table -->
...
<Member name="HomePage" PersistentField="HomePage" />
</Type>
</Mapping>
Using the schema defined above, the OQL query
extentof(Supplier)[HomePage=="http://www.exotic-liquids.com"]
is translated to
SELECT bc.*, s.* FROM BusinessContact bc LEFT JOIN tbl_supplier s ON bc.Id = s.Id
WHERE bc.HomePage='http://www.exotic-liquids.com'
Type: TechTalk.Genome.Mapping.JoinedInheritanceXmlData
Assembly: TechTalk.Genome.dll
Version: 4.2.4
Editions: Professional, Evaluation, Express
Database Platforms: Microsoft SQL Server 2000, Microsoft SQL Server 2005, Oracle 9i Release 2, Oracle 10g Release 2
Type Extent Providers | <RootInheritance> Element | <SharedInheritance> Element