Re: Cleaning up inheritance tests

From: Kevin Menard (kmenar..ervprise.com)
Date: Sat Mar 29 2008 - 15:25:09 EDT

  • Next message: Andrus Adamchik: "Re: Cleaning up inheritance tests"

    On 3/29/08 3:07 PM, "Andrus Adamchik" <andru..bjectstyle.org> wrote:

    >
    > On Mar 29, 2008, at 8:39 PM, Kevin Menard wrote:
    >
    >> I think we may have had a different understanding of what redundant
    >> means.
    >> I was thinking internal to Cayenne, not considering relationships
    >> mapped by
    >> the user as "redundant", even if they may in fact be.
    >
    > There's no difference in the runtime... Redundant is redundant, and we
    > either know how to handle it or not.

    Well, there is a difference. If you disallow redundant, fine, but if the
    user never maps redundant relationships, but Cayenne creates them, that's a
    problem.

    Likewise, there may be a reason a user is mapping multiple relationships,
    and in that case, I'd call the term "redundant" pejorative. If Cayenne does
    not need the relationships that it is creating, however, those would be
    redundant. As near as I can tell, that is the case.

    Note a huge distinction, but I think there should be one from the user's
    perspective and from the perspective of the runtime.
     
    > Hmm... Bailing on runtime relationships (at least on the required
    > variety) would result in us losing support for one-way to-many (and
    > IIRC also one-way 1..1) which would be a very serious downgrade. I
    > don't see any *simple* alternative to handle that functionality. But i
    > we develop one, I'd say drop runtime ObjRelationships and only keep
    > the Db.

    I'll have to chew on this one. I don't think the relationships I'm looking
    to cut out are useful to Cayenne at all though. Without them, my test cases
    still work. The created relationships are never used by the user and I
    don't think they're even useful to Cayenne.

    Once again, their presence or lack thereof have no real bearing on the
    larger issue of CAY-1008. Other than that if we disallow redundant
    relationships as a fix for CAY-1008, then we shouldn't introduce them at
    runtime.
     
    > Until then that I'd rather change my earlier statement about
    > "BaseEntity -> DirectToSubEntity -> SubEntity" relationships chain,
    > and call it "implicitly redundant". This would be equivalent to the
    > following rule:
    >
    > "All Cayenne ObjRelationships implicitly or explicitly require a
    > single reverse relationship. If the mapping does not contain a reverse
    > relationship, Cayenne creates one (invisible to the user) during
    > runtime. If the mapping results in more than one relationship matching
    > reverse relationship criteria, this will result in a runtime exception
    > thrown".
    >
    > That's how I see the "lazy" option implementation.

    Then my vote is a -1 on the lazy option. The rules here are overly complex.
    As a user, I wouldn't expect a relationship that I either: a) explicitly
    deleted, or b) never added, to be added by Cayenne and invalidate my graph.
    Additionally, it would basically eliminate any relationships to subclasses,
    which I think would call the utility of the inheritance system into question
    altogether. Although, maybe not. I'm rather surprised I'm the first to run
    into such issues that seem basic to me. Either I'm abusing inheritance by
    using relationships to the subclasses, or others have gotten lucky, because
    the presence of a problem depends on the iteration order of the
    relationships.

    If we want to go down the path of allowing multiple reverse relationships, I
    can lead the work up. I don't want you to think I'm trying to shell this
    off on you. I just don't want to be making large architectural changes
    without someone else keeping me in check.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Sat Mar 29 2008 - 15:25:44 EDT