TechTalk Genome v4.2

<JoinedInheritance> Element

Specifies that the fields defined on the type are stored in a separate table in the underlying relational database system.

<Type name=" type ">
<JoinedInheritance [catalogName="catalog"] [owner="database-user"] [tableName="table"] >
A type specifying a persistent class.
A catalog (database) name in the underlying relational database system. If the catalog is not specified, the default catalog of the DataDomain is used.
A database user name. If the database-user is not specified, the default database user (dbo in Microsoft SQL Server) is used.
The name of a database table in which the fields of the type are stored. If the table is not specified, the short name of type is used.
The <CheckIntegrity> element specifies if referential integrity between the table created for this type and the table of its base type is enforced with a foreign key constraint in the database.


<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.

table A
Id fields fields of the T0
#1 field values of object #1
#2 field values of object #2
#3 field values of object #3 for the fields defined on type T0
table B
Id fields fields of T 
#3 field values of object #3 for the fields defined on type T
The tables storing the state of type T.
(object #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.

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; }
<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">

    <Type name="BusinessContact">
        <RootInheritance />
        <Member name="Id" PersistentField="Id" />
        <Member name="CompanyName" PersistentField="Name" />
    <Type name="Supplier">
        <JoinedInheritance tableName="TBL_SUPPLIER" />
        <!-- <JoinedInheritance /> would store the homepage in the "Supplier" table -->
        <Member name="HomePage" PersistentField="HomePage" />

Using the schema defined above, the OQL query


is translated to

    SELECT bc.*, s.* FROM BusinessContact bc LEFT JOIN tbl_supplier s ON bc.Id = s.Id
    WHERE bc.HomePage=''  


Type: TechTalk.Genome.Mapping.JoinedInheritanceXmlData

Assembly: TechTalk.Genome.dll

Version: 4.2.11

Editions: Professional, Evaluation, Express

Database Platforms: Microsoft SQL Server 2000, Microsoft SQL Server 2005, Oracle 9i Release 2, Oracle 10g Release 2

See Also

Type Extent Providers | <RootInheritance> Element | <SharedInheritance> Element