Modifying an object that has a to one relationship to an object that uses 
inheritance, breaks the relationship.
---------------------------------------------------------------------------------------------------------------

         Key: CAY-592
         URL: http://issues.apache.org/cayenne/browse/CAY-592
     Project: Cayenne
        Type: Bug

  Components: Cayenne Core Library  
    Versions: 1.2    
    Reporter: Andrus Adamchik
 Assigned to: Andrus Adamchik 
    Priority: Critical
     Fix For: 1.2


First reported here: 
http://objectstyle.org/cayenne/lists/cayenne-user/2006/07/0020.html

A unit test to reproduce (part of InheritanceTst class):

    public void testCAY592() throws Exception {
        createTestData("testManagerAddress");
        List addresses = context.performQuery(new SelectQuery(Address.class));

        assertEquals(1, addresses.size());
        Address address = (Address) addresses.get(0);
        Employee e = address.getToEmployee();

        // CAY-592 - make sure modification of the address in a parallel 
context 
        // doesn't tmess up the Manager
        DataContext c2 = context.getParentDataDomain().createDataContext();
        e = (Employee) DataObjectUtils.objectForPK(c2, e.getObjectId());
        address = (Address) e.getAddresses().get(0);
  
        assertSame(e, address.getToEmployee());
        address.setCity("XYZ");
        assertSame(e, address.getToEmployee());
    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/cayenne/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to