Re: Abstract Entities [Was: Modelling improvements: inheritance + interfacing (Draft)]

From: Lachlan Deck (lachlan.dec..mail.com)
Date: Wed May 30 2007 - 00:27:39 EDT

  • Next message: Lachlan Deck: "Re: Abstract Entities [Was: Modelling improvements: inheritance + interfacing (Draft)]"

    On 29/05/2007, at 8:01 PM, Andrus Adamchik wrote:

    > Trying to decompose it further (so that we could Jira individual
    > chunks easily :-))... +1 for the abstract entities support, but
    > they can also be implemented as a separate feature independent from
    > inheritance per se.

    True.

    >> <obj-entity ...> needs the following additional (optional) xml
    >> attributes:
    >> - isAbstract="flag"
    >
    > +1
    >
    > Also the following steps will be needed:
    >
    > * Modeler checkbox for ObjEntity "abstract" flag
    > * Changes to the code generation templates to generate abstract
    > java classes for such entities

    Yep.

    > * Changes to the validation rules to allow ObjEntity with no db
    > entity for abstract entities

    The question of 'isAbstract' is merely a question of 'can instances
    of this entity be instantiated'?

    Certainly changes to validation rules are necessary. But it is
    possible for an entity to be both abstract whilst having an
    associated db entity (e.g., vertical inheritance where the developer
    doesn't desire to instantiate instances of parent entity).

    > * maybe also some runtime checks for abstract entity (???)

    The only runtime checks I can foresee at the moment are:
    - a CayenneRuntimeException for attempting to do a fetch on an
    ObjEntity that has no associated db entity.

    Other logic will need to be in place that determines how deep the
    fetch is. e.g., if there's a SelectQuery on a parent entity that's
    abstract then this would imply a deep fetch (i.e., of sub-entity
    instances). If however the parent is not abstract then (even for
    horizontal inheritance) instances of the parent are fetched
    (resolving attributes appropriately from children for horizontal).

    with regards,

    --
    

    Lachlan Deck



    This archive was generated by hypermail 2.0.0 : Wed May 30 2007 - 00:28:14 EDT