Package com.google.appengine.datanucleus.test.jpa

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


  public void testDeleteChildWithSeparateNameField_NoTxn() throws Exception {
    testDeleteChildWithSeparateNameField(TXN_START_END);
  }
  private void testDeleteChildWithSeparateNameField(StartEnd startEnd) throws Exception {
    HasChildWithSeparateNameFieldJPA parent = new HasChildWithSeparateNameFieldJPA();
    HasEncodedStringPkSeparateNameFieldJPA child = new HasEncodedStringPkSeparateNameFieldJPA();
    child.setName("the name");
    parent.getChildren().add(child);
    startEnd.start();
    em.persist(parent);
    startEnd.end();
    startEnd.start();
View Full Code Here


  public void testDeleteChildWithSeparateNameField_NoTxn() throws Exception {
    testDeleteChildWithSeparateNameField(TXN_START_END);
  }
  private void testDeleteChildWithSeparateNameField(StartEnd startEnd) throws Exception {
    HasChildWithSeparateNameFieldJPA parent = new HasChildWithSeparateNameFieldJPA();
    HasEncodedStringPkSeparateNameFieldJPA child = new HasEncodedStringPkSeparateNameFieldJPA();
    child.setName("the name");
    parent.getChildren().add(child);
    startEnd.start();
    em.persist(parent);
    startEnd.end();
    startEnd.start();
View Full Code Here

      rollbackTxn();
    }
  }

  public void testEncodedStringPk_SeparateNameField() throws EntityNotFoundException {
    HasEncodedStringPkSeparateNameFieldJPA pojo = new HasEncodedStringPkSeparateNameFieldJPA();
    pojo.setName("a name");
    beginTxn();
    em.persist(pojo);
    commitTxn();

    assertEquals(TestUtils.createKey(pojo, "a name"), KeyFactory.stringToKey(pojo.getId()));
    Entity e = ds.get(KeyFactory.stringToKey(pojo.getId()));

    beginTxn();
    pojo = em.find(HasEncodedStringPkSeparateNameFieldJPA.class, e.getKey().getName());
    assertEquals("a name", pojo.getName());
    em.find(HasEncodedStringPkSeparateNameFieldJPA.class, e.getKey());
    assertEquals("a name", pojo.getName());
    em.find(HasEncodedStringPkSeparateNameFieldJPA.class, KeyFactory.keyToString(e.getKey()));
    assertEquals("a name", pojo.getName());
    commitTxn();

  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.HasEncodedStringPkSeparateNameFieldJPA

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.