I stumbled across a weird thing today and believe that it has something to do 
with the fact that I am a cayenne newbie. Here is the situation:

I have a many-to-many relationship: Blog <<=>> DataSource. 
I have configured it in the modeler the simplest way possible, without any 
specific relationship table and no flattened relation.
I have this test snippet: 

System.out.println(blog1.getDatasources().get(0));                              
      // prints datasource0
System.out.println(blog1.getDatasources().get(1));                              
      // prints datasouce1

blog1.getObjectContext().deleteObjects(blog1.getDatasources().get(1));  // 
delete datasource1
blog1.getObjectContext().commitChanges();                                       
     // commit changes
System.out.println(blog1.getDatasources().get(0));                              
       // prints datasource0
System.out.println(blog1.getDatasources().get(1));                              
       // prints datasource1 <= WHY?
Assert.assertEquals(1, blog1.getDatasources().size());                          
      // FAILS
 
Am I doing something wrong here?

Thanks.

Reply via email to