Package com.google.appengine.datanucleus.test.jdo

Examples of com.google.appengine.datanucleus.test.jdo.HasOneToOneChildAtMultipleLevelsJDO


    getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
    pm.getFetchPlan().setMaxFetchDepth(3);
    testChildAtMultipleLevels(NEW_PM_START_END);
  }
  private void testChildAtMultipleLevels(StartEnd startEnd) throws EntityNotFoundException {
    HasOneToOneChildAtMultipleLevelsJDO pojo = new HasOneToOneChildAtMultipleLevelsJDO();
    Flight f1 = new Flight();
    pojo.setFlight(f1);
    HasOneToOneChildAtMultipleLevelsJDO child = new HasOneToOneChildAtMultipleLevelsJDO();
    Flight f2 = new Flight();
    child.setFlight(f2);
    pojo.setChild(child);
    startEnd.start();
    pm.makePersistent(pojo);
    startEnd.end();
    startEnd.start();
    pojo = pm.getObjectById(HasOneToOneChildAtMultipleLevelsJDO.class, pojo.getId());
    assertEquals(f1.getId(), pojo.getFlight().getId());
    assertEquals(child.getId(), pojo.getChild().getId());
    assertEquals(child.getFlight(), f2);
    assertNull(child.getChild());
    startEnd.end();

    Entity pojoEntity = ds.get(pojo.getId());
    Entity childEntity = ds.get(child.getId());
    Entity flight1Entity = ds.get(KeyFactory.stringToKey(f1.getId()));
    Entity flight2Entity = ds.get(KeyFactory.stringToKey(f2.getId()));
    assertEquals(flight1Entity.getKey(), pojoEntity.getProperty("flight_id_OID"));
    assertEquals(childEntity.getKey(), pojoEntity.getProperty("child_id_OID"));
    assertEquals(flight2Entity.getKey(), childEntity.getProperty("flight_id_OID"));
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.HasOneToOneChildAtMultipleLevelsJDO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.