You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Marcin Skladaniec (JIRA)" <ca...@incubator.apache.org> on 2007/02/08 13:14:50 UTC

[JIRA] Created: (CAY-748) many to many and objects in different context

many to many and objects in different context
---------------------------------------------

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


If there exists a flattened many to many relationship Project - Employee:

CayenneContext context = ContextManager.getNewContext()
CayenneContext context2 = ContextManager.getNewContext();
		
List projects = context.performQuery(new SelectQuery(Project.class));
List employees= context2.performQuery(new SelectQuery(Employee.class));
		
Project p = (Project)projects.get(0);
Employee e = (Employee)employees.get(0);
logger.info(p.getEmployees().size()); => gives 0
logger.info(e.getProjects() .size()); => gives 0
e.addToProjects(p);
logger.info(p.getEmployees().size()); => gives 1
logger.info(e.getProjects() .size()); => gives 2 !!

Adding objects from different context causes the relationship to be doubled at one end.
I'm sorry I have no time at the moment to investigate this issue further.

Marcin

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