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

From: Marcin Skladaniec (JIRA) ("Marcin)
Date: Thu Feb 08 2007 - 07:14:50 EST

  • Next message: Andrus Adamchik: "Re: [JIRA] Commented: (CAY-705) Ordering.sortList() does not work with null relationships"

    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.
    



    This archive was generated by hypermail 2.0.0 : Thu Feb 08 2007 - 07:15:22 EST