Single Table Inheritance Implementation

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Apr 06 2004 - 21:08:39 EDT

  • Next message: Mike Kienenberger: "Re: ObjEntity qualifer [was Single Table Inheritance Implementation]"

    Just checked in the first cut of single table inheritance feature. With
    modeler support. Cayenne makes a decision which class should be used in
    the inheritance hierarchy based on the entity qualifier. Yes, ObjEntity
    qualifier is now fully supported, and independent from inheritance for
    that matter.

    Having a qualifier is the most flexible way to figure out the right
    class in the hierarchy (compared to say a constant value in a single
    column). However it is also very easy to shoot yourself in the foot
    with incompatible qualifiers. Raw power :-)...

    SelectQuery.resolvingInherited property defines Cayenne behavior on
    fetch. Cayenne can disregard inheritance and create all objects using
    the root query type (currently the default... maybe should change
    that). Or it can determine correct object subtype on fetch, returning a
    list of mixed types. Of course all objects belong to either the root
    query class or one of the subclasses. First method is faster, but is
    also incorrect, and leads to uniquing issues that I am not quiet sure
    how to resolve. Second method is slower, since Cayenne needs to analyze
    each fetched row to figure out the right class.

    One remaining issue is helping users to initialize NEW objects with
    default values. Ideally Cayenne should "know" what values to add to a
    snapshot when saving a given class in the hierarchy. I guess I'll have
    to add modeler code to configure that.

    Enjoy.
    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Apr 06 2004 - 21:08:48 EDT