Examples of HasOneToOneWithKey


Examples of com.google.appengine.datanucleus.test.jdo.UnownedUpgradeJDO.HasOneToOneWithKey

    sideB1.setName("yar");
    beginTxn();
    pm.makePersistent(sideB1);
    commitTxn();

    HasOneToOneWithKey withKey = new HasOneToOneWithKey();
    withKey.setOther(KeyFactory.createKey("UnownedUpgradeJDO$SideB", sideB1.getId()));
    beginTxn();
    pm.makePersistent(withKey);
    commitTxn();

    beginTxn();
    assertNotNull(pm.getObjectById(HasOneToOneWithKey.class, withKey.getId()).getOther());
    commitTxn();

    // Read back in using latest storage version, as unowned
    Map<String, String> props = Utils.newHashMap();
    props.put("datanucleus.appengine.datastoreEnableXGTransactions", Boolean.TRUE.toString());
    switchDatasource(PersistenceManagerFactoryName.transactional, props);

    beginTxn();
    HasOneToOneWithUnowned withUnowned = pm.getObjectById(HasOneToOneWithUnowned.class, withKey.getId());
    assertNotNull(withUnowned.getOther());
    assertEquals(sideB1.getId(), withUnowned.getOther().getId());
    commitTxn();
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.UnownedUpgradeJPA.HasOneToOneWithKey

    sideB1.setName("yar");
    beginTxn();
    em.persist(sideB1);
    commitTxn();

    HasOneToOneWithKey withKey = new HasOneToOneWithKey();
    withKey.setOther(KeyFactory.createKey("UnownedUpgradeJPA$SideB", sideB1.getId()));
    beginTxn();
    em.persist(withKey);
    commitTxn();

    beginTxn();
    assertNotNull(em.find(HasOneToOneWithKey.class, withKey.getId()).getOther());
    commitTxn();

    Map<String, String> props = Utils.newHashMap();
    props.put("datanucleus.appengine.datastoreEnableXGTransactions", Boolean.TRUE.toString());
    props.put("datanucleus.appengine.storageVersion", StorageVersion.PARENTS_DO_NOT_REFER_TO_CHILDREN.name());
    switchDatasource(EntityManagerFactoryName.originalStorageVersion, props);

    // Now read it back as an unowned relationship
    beginTxn();
    HasOneToOneWithUnowned withUnowned = em.find(HasOneToOneWithUnowned.class, withKey.getId());
    assertNotNull(withUnowned.getOther());
    assertEquals(sideB1.getId(), withUnowned.getOther().getId());
    commitTxn();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.