Re: CAY-1378, CAY-1009...

From: Kevin Menard (nirvdru..mail.com)
Date: Mon Feb 08 2010 - 08:39:17 EST

  • Next message: Andrey Razumovsky: "Re: CAY-1378, CAY-1009..."

    On Sun, Feb 7, 2010 at 11:23 AM, Andrus Adamchik <andru..bjectstyle.org>wrote:

    > On Feb 7, 2010, at 5:39 PM, Andrey Razumovsky wrote:
    >
    > Also we need to check Victor's comment:
    >>
    >> https://issues.apache.org/jira/browse/CAY-1009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804515
    >> #action_12804515
    >>
    >
    > I did and I agree with him about the semantics of the fix.
    >

    I'm reaching here a bit since it's been a while since I looked at this
    problem, but I think the semantics were preserved because isSubentityOf
    wasn't a proper subentity relationship. I.e., an entity could be a
    subentity of itself. So, while the code looks strange, it worked.

    >
    > Also, answering my own earlier observation:
    >
    >
    > DirectToSubEntity.subEntities is NOT a reverse relationship of
    >> BaseEntity.toDirectToSubEntity,
    >>
    >
    > Looks like a simple model of relationship/reverse relationship breaks when
    > inheritance is involved. If we define "reverse" as relationship over the
    > same set of joins, just going in the opposite direction, then we can have
    > multiple reverse relationships for any single relationship and will need to
    > do much more e.g. when connecting related objects...
    >
    >
    I'll have to take a look at this test case again. I believe my patch fixed
    a very specific instance of what I thought at the time was a much larger
    problem.

    The core issue I was seeing at the time was something along the lines of:

    Customer is a subclass of Account
    Customer requires an Address

    There is no explicit mapping from Account to Address.
    There is a mapping between Customer and Address and is marked as mandatory.

    Cayenne added a runtime relationship from Account to Address and used that
    when doing something like customer.setAddress(), bypassing the mapped
    relationship, which caused a validation failure.

    IIRC, the patch I supplied allowed the relationship search to compare
    against a broader range of src-target pairings, allowing it to find the
    relationship I explicitly mapped.

    I may have some of the details wrong there since I haven't dealt with this
    is a while. But I should be able to pull up the mapping that wasn't working
    for me.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Mon Feb 08 2010 - 08:40:27 EST