}
public void testRemoveToMany() throws Exception {
createTestData("prepare");
MapToMany o1 = DataObjectUtils.objectForPK(
createDataContext(),
MapToMany.class,
1);
Map targets = o1.getTargets();
assertEquals(3, targets.size());
MapToManyTarget target = (MapToManyTarget) targets.get("B");
o1.removeFromTargets(target);
assertEquals(2, targets.size());
assertNull(o1.getTargets().get("B"));
assertNull(target.getMapToMany());
o1.getObjectContext().commitChanges();
o1.getObjectContext().performGenericQuery(new RefreshQuery());
assertEquals(2, o1.getTargets().size());
assertNotNull(o1.getTargets().get("A"));
assertNotNull(o1.getTargets().get("C"));
}