switchDatasource(PersistenceManagerFactoryName.nontransactional);
getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
testOneToManyChildAtMultipleLevels(NEW_PM_START_END);
}
public void testOneToManyChildAtMultipleLevels(StartEnd startEnd) {
HasOneToManyChildAtMultipleLevelsJDO pojo = new HasOneToManyChildAtMultipleLevelsJDO();
Flight f1 = new Flight();
pojo.setFlights(Utils.newArrayList(f1));
HasOneToManyChildAtMultipleLevelsJDO child = new HasOneToManyChildAtMultipleLevelsJDO();
Flight f2 = new Flight();
child.setFlights(Utils.newArrayList(f2));
pojo.setChild(child);
startEnd.start();
pm.makePersistent(pojo);
startEnd.end();
startEnd.start();
assertEquals(2, countForClass(Flight.class));
pojo = pm.getObjectById(HasOneToManyChildAtMultipleLevelsJDO.class, pojo.getId());
assertEquals(child.getId(), pojo.getChild().getId());
assertEquals(1, pojo.getFlights().size());
assertTrue(pojo.getFlights().get(0).customEquals(f1));
assertTrue(child.getFlights().get(0).customEquals(f2));
assertEquals(1, child.getFlights().size());
startEnd.end();
}