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

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed May 30 2007 - 05:00:11 EDT

  • Next message: Andrus Adamchik: "Modeling Interfaces [Was: Modelling improvements: inheritance + interfacing (Draft)]"

    On May 30, 2007, at 7:27 AM, Lachlan Deck wrote:

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

    Right. I guess ObjEntity without a DbEntity feature can be tucked
    onto one of the inheritance tasks.

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

    This may also be a part of the inheritance discussion, but here is a
    one thing to note: SelectQuery (and other queries) supports
    "setResolvingInherited", which is a deep-fetch vs. no-deep-fetch flag.

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed May 30 2007 - 05:00:39 EDT