You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Marcin Skladaniec (JIRA)" <ji...@apache.org> on 2009/03/15 04:56:18 UTC

[jira] Created: (CAY-1194) problems with relationships when using nested contexts and ROP

problems with relationships when using nested contexts and ROP
--------------------------------------------------------------

                 Key: CAY-1194
                 URL: https://issues.apache.org/cayenne/browse/CAY-1194
             Project: Cayenne
          Issue Type: Bug
          Components: Cayenne Core Library
    Affects Versions: 3.0M5
         Environment: ROP
            Reporter: Marcin Skladaniec


The problem reveals itself in several ways. I'll attach a junit case to show one of the problems. 

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


[jira] Updated: (CAY-1194) problems with relationships when using nested contexts and ROP

Posted by "Ari Maniatis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/cayenne/browse/CAY-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ari Maniatis updated CAY-1194:
------------------------------

        Fix Version/s: 3.0M6
             Assignee: Andrey Razumovsky
    Affects Version/s:     (was: 3.0M5)
                       3.0M6

> problems with relationships when using nested contexts and ROP
> --------------------------------------------------------------
>
>                 Key: CAY-1194
>                 URL: https://issues.apache.org/cayenne/browse/CAY-1194
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 3.0M6
>         Environment: ROP
>            Reporter: Marcin Skladaniec
>            Assignee: Andrey Razumovsky
>             Fix For: 3.0M6
>
>
> The problem reveals itself in several ways. I'll attach a junit case to show one of the problems. 

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


[jira] Commented: (CAY-1194) problems with relationships when using nested contexts and ROP

Posted by "Andrey Razumovsky (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/cayenne/browse/CAY-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13285#action_13285 ] 

Andrey Razumovsky commented on CAY-1194:
----------------------------------------

Marcin,

Thanks for junit test. 
This is a harsh issue. I can confirm it can also be reproduced on normal nested DataContexts.
The root of the problem is that when child's to-many property is being resolved, it sends query to parent context - It is intercepted there, because parent object's to-many list is already resolved. So "objectList" in child's PersistentObjectList is parent's PersistentObjectList. That's why all changes are applied without commit. We'll likely need to duplicate the list.. Will need some more time to find a proper fix..

> problems with relationships when using nested contexts and ROP
> --------------------------------------------------------------
>
>                 Key: CAY-1194
>                 URL: https://issues.apache.org/cayenne/browse/CAY-1194
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 3.0M6
>         Environment: ROP
>            Reporter: Marcin Skladaniec
>            Assignee: Andrey Razumovsky
>             Fix For: 3.0M6
>
>
> The problem reveals itself in several ways. I'll attach a junit case to show one of the problems. 

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


[jira] Closed: (CAY-1194) problems with relationships when using nested contexts and ROP

Posted by "Andrey Razumovsky (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/cayenne/browse/CAY-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey Razumovsky closed CAY-1194.
----------------------------------

    Resolution: Fixed

> problems with relationships when using nested contexts and ROP
> --------------------------------------------------------------
>
>                 Key: CAY-1194
>                 URL: https://issues.apache.org/cayenne/browse/CAY-1194
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 3.0M6
>         Environment: ROP
>            Reporter: Marcin Skladaniec
>            Assignee: Andrey Razumovsky
>             Fix For: 3.0M6
>
>
> The problem reveals itself in several ways. I'll attach a junit case to show one of the problems. 

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


[jira] Commented: (CAY-1194) problems with relationships when using nested contexts and ROP

Posted by "Marcin Skladaniec (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/cayenne/browse/CAY-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13280#action_13280 ] 

Marcin Skladaniec commented on CAY-1194:
----------------------------------------

public void testCAY1194() throws Exception {
        deleteTestData();
        
        ClientMtTable1 parentMt = context.newObject(ClientMtTable1.class);
        
        
        ObjectContext child = context.createChildContext();
        
        ClientMtTable2 childMt2 = child.newObject(ClientMtTable2.class);
        childMt2.setGlobalAttribute("222");
        
        ClientMtTable1 localParentMt = (ClientMtTable1)child.localObject(parentMt.getObjectId(), null);
        assertEquals(0,parentMt.getTable2Array().size());
        assertEquals(0,localParentMt.getTable2Array().size());
        
        childMt2.setTable1(localParentMt);
        
        assertEquals(0,parentMt.getTable2Array().size()); //* (see notes)
        assertEquals(1,localParentMt.getTable2Array().size());
        
        child.commitChangesToParent();
        assertEquals(1,parentMt.getTable2Array().size()); //** (see notes)
        
        // notes:
        // if the * test is removed, but the call to parentMt.getTable2Array().size() is executed ** will fail, the parent table will be linked to 2 records instead of one, moreover, the context of one of the related objects will not match the parent record context
    }

> problems with relationships when using nested contexts and ROP
> --------------------------------------------------------------
>
>                 Key: CAY-1194
>                 URL: https://issues.apache.org/cayenne/browse/CAY-1194
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 3.0M5
>         Environment: ROP
>            Reporter: Marcin Skladaniec
>
> The problem reveals itself in several ways. I'll attach a junit case to show one of the problems. 

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