[jira] Commented: (CAY-1009) Bogus runtime relationships can mess up commit.

From: Kevin Menard (JIRA) ("Kevin)
Date: Sun Mar 16 2008 - 11:08:38 EDT

  • Next message: Andrus Adamchik: "Re: Summer of Code"

        [ https://issues.apache.org/cayenne/browse/CAY-1009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787#action_12787 ]

    Kevin Menard commented on CAY-1009:
    -----------------------------------

    Reposting from list to keep track . . .

    Okay, I finally made some progress. The issue seems to be that the way the
    test stack is built bypasses a call to applyObjectLayerDefaults() in
    EntityResolver. It is this call that creates the bogus relationships, thus
    me not being able to reproduce.

    I still haven't managed to create the commit issue I saw before, but I think
    this may be related to the problem in CAY-1008, whereby the first found
    relationship is used. I could be unlucky and the first found one is the
    explicitly mapped one, not the runtime created one, which would cause things
    to appear to work fine.

    My gut feeling is that the problem is in
    ObjRelationship#getReverseRelationship. Particularly, line #191 has the
    following check:

    if (rel.getTargetEntity() != src)

    I think that should probably be some sort of instanceof operation. If
    there's an explicit mapping to a subclass, we probably should consider that
    good enough and not create a runtime relationship to the base class. I'm
    not sure of the full impact that change would make, however.

    > Bogus runtime relationships can mess up commit.
    > -----------------------------------------------
    >
    > Key: CAY-1009
    > URL: https://issues.apache.org/cayenne/browse/CAY-1009
    > Project: Cayenne
    > Issue Type: Bug
    > Components: Cayenne Core Library
    > Affects Versions: 3.0
    > Reporter: Kevin Menard
    > Assignee: Andrus Adamchik
    >
    > I'm still the process of investigating this one, so more details to come. Basically what I'm seeing is that if two ObjRels map to the same DbRel somehow and only one is mapped explicitly, the runtime one can fail validation while the specified one passes. I'm observing this in a relationship that involves inheritance. It looks like I've explicitly mapped an ObjRel for the subclass type and Cayenne is creating one for the base class. The DbAttr is marked as required. Since I never specify a value in the runtime relationship, since it's not mapped or useful to me, validation fails. If I don't mark the attribute as mandatory, everything commits just fine. So, I suspect Cayenne resolves the conflict somewhere down the line.

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Sun Mar 16 2008 - 11:10:24 EDT