[ 
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.

Reply via email to