testUpdate_UpdateChild(NEW_PM_START_END);
}
public void testUpdate_UpdateChild(StartEnd startEnd) throws EntityNotFoundException {
Flight f = newFlight();
HasKeyPkJDO hasKeyPk = new HasKeyPkJDO();
HasOneToOneParentJDO hasParent = new HasOneToOneParentJDO();
HasOneToOneParentKeyPkJDO hasParentKeyPk = new HasOneToOneParentKeyPkJDO();
HasOneToOneJDO pojo = new HasOneToOneJDO();
pojo.setFlight(f);
pojo.setHasKeyPK(hasKeyPk);
pojo.setHasParent(hasParent);
hasParent.setParent(pojo);
pojo.setHasParentKeyPK(hasParentKeyPk);
hasParent.setParent(pojo);
startEnd.start();
pm.makePersistent(pojo);
assertNotNull(f.getId());
assertNotNull(hasKeyPk.getKey());
assertNotNull(hasParentKeyPk.getKey());
assertNotNull(hasParent.getKey());
assertNotNull(pojo.getId());
startEnd.end();
startEnd.start();
pojo = pm.getObjectById(HasOneToOneJDO.class, pojo.getId());
pojo.getFlight().setOrigin("yam");
pojo.getHasKeyPK().setStr("yar");
pojo.getHasParent().setStr("yag");
pojo.getHasParentKeyPK().setStr("yap");
startEnd.end();
Entity flightEntity = ds.get(KeyFactory.stringToKey(f.getId()));
assertNotNull(flightEntity);
assertEquals("yam", flightEntity.getProperty("origin"));
assertKeyParentEquals(pojo.getId(), flightEntity, f.getId());
Entity hasKeyPkEntity = ds.get(hasKeyPk.getKey());
assertNotNull(hasKeyPkEntity);
assertEquals("yar", hasKeyPkEntity.getProperty("str"));
assertKeyParentEquals(pojo.getId(), hasKeyPkEntity, hasKeyPk.getKey());
Entity hasParentEntity = ds.get(KeyFactory.stringToKey(hasParent.getKey()));
assertNotNull(hasParentEntity);
assertEquals("yag", hasParentEntity.getProperty("str"));
assertKeyParentEquals(pojo.getId(), hasParentEntity, hasParent.getKey());
Entity hasParentKeyPkEntity = ds.get(hasParentKeyPk.getKey());
assertNotNull(hasParentKeyPkEntity);
assertEquals("yap", hasParentKeyPkEntity.getProperty("str"));
assertKeyParentEquals(pojo.getId(), hasParentKeyPkEntity, hasParentKeyPk.getKey());