Examples of HasKeyAncestorStringPkJPA


Examples of com.google.appengine.datanucleus.test.jpa.HasKeyAncestorStringPkJPA

  }

  public void testInsertWithStringPkAndKeyAncestor_IdGen() throws EntityNotFoundException {
    Entity e = new Entity("yam");
    ds.put(e);
    HasKeyAncestorStringPkJPA hk1 = new HasKeyAncestorStringPkJPA();
    hk1.setAncestorKey(e.getKey());
    beginTxn();
    em.persist(hk1);
    commitTxn();

    Entity reloaded = ds.get(KeyFactory.stringToKey(hk1.getKey()));
    assertEquals(hk1.getAncestorKey(), reloaded.getKey().getParent());
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.HasKeyAncestorStringPkJPA

  }

  public void testInsertWithStringPkAndKeyAncestor_NamedKey() throws EntityNotFoundException {
    Entity e = new Entity("yam");
    ds.put(e);
    HasKeyAncestorStringPkJPA hk1 = new HasKeyAncestorStringPkJPA();
    Key keyToSet =
        new Entity(HasKeyAncestorStringPkJPA.class.getSimpleName(), "yar", e.getKey()).getKey();
    hk1.setKey(KeyFactory.keyToString(keyToSet));
    beginTxn();
    em.persist(hk1);
    commitTxn();
    String key = hk1.getKey();
    assertEquals(e.getKey(), hk1.getAncestorKey());
    Entity reloaded = ds.get(KeyFactory.stringToKey(key));
    assertEquals(e.getKey(), reloaded.getKey().getParent());
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.HasKeyAncestorStringPkJPA

  }

  public void testInsertWithStringPkAndKeyAncestor_SetAncestorAndPk() throws EntityNotFoundException {
    Entity parentEntity = new Entity("yam");
    ds.put(parentEntity);
    HasKeyAncestorStringPkJPA hk1 = new HasKeyAncestorStringPkJPA();
    Key keyToSet =
        new Entity(HasKeyAncestorStringPkJPA.class.getSimpleName(), "yar", parentEntity.getKey()).getKey();
    hk1.setKey(KeyFactory.keyToString(keyToSet));
    hk1.setAncestorKey(keyToSet);
    beginTxn();
    em.persist(hk1);
    try {
      commitTxn();
      fail("expected exception");
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.