Examples of Child21


Examples of com.google.appengine.datanucleus.test.jpa.SingleTableInheritanceJPA.Child21

    Assert.assertEquals(1, c12.getChild11Manys().size());
    Assert.assertEquals("Child11ManyStr", c12.getChild11Manys().get(0).getStr());
    startEnd.end();
   
    //  create Child21
    Child21 c21 = newChild21(startEnd, null, 21L);   
    Long c21Id = c21.getId();
    Key c21Key = KeyFactory.createKey(PARENT_KIND, c21Id);
   
    //  verify Child21 entity
    Entity c21e = ds.get(c21Key);
    Assert.assertEquals(c21Key, c21e.getKey());
    Assert.assertEquals("C21", c21e.getProperty("DTYPE"));
    Assert.assertTrue(c21e.hasProperty("parentStr"));
    Assert.assertNull(c21e.getProperty("parentStr"));
    Assert.assertEquals(21L, c21e.getProperty("child21Long"));
    Assert.assertTrue(c21e.hasProperty("str"));
    Assert.assertNull(c21e.getProperty("str"));
    Assert.assertTrue(c21e.hasProperty("dbl"));
    Assert.assertNull(c21e.getProperty("dbl"));
    Assert.assertEquals(5, c21e.getProperties().size());

    //  verify Child21 object
    startEnd.start();
    c21 = em.find(Child21.class, c21Id);
    Assert.assertEquals(c21Id, c21.getId());
    Assert.assertEquals(21L, c21.getChild21Long());
    Assert.assertNull(c21.getParentStr());
    startEnd.end();

    //  create Child22
    Child22 c22 = newChild22(startEnd, "ParentChild22", "Child22", Boolean.TRUE, new Embedded2("Embedded2Child22", -7d));
    Long c22Id = c22.getId();
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.SingleTableInheritanceJPA.Child21

    props.put("datanucleus.appengine.getExtentCanReturnSubclasses", Boolean.TRUE.toString());
    switchDatasource(EntityManagerFactoryName.transactional_ds_non_transactional_ops_not_allowed, props);
    Parent p = newParent(startEnd, "Parent");
    Long pId = p.getId();

    Child21 c21 = newChild21(startEnd, "Child21", 21L);
    Long c21Id = c21.getId();
   
    startEnd.start();
    Query q = em.createQuery("select from " + Parent.class.getName() + " b where id = :id");
    q.setParameter("id", pId);
    List<Parent> r = (List<Parent>)q.getResultList();
    Assert.assertEquals(1, r.size());
    p = r.get(0);
    Assert.assertEquals(pId, p.getId());
    Assert.assertEquals("Parent", p.getParentStr());
    startEnd.end();

    startEnd.start();
    q = em.createQuery("select from " + Parent.class.getName() + " b where id = :id");
    q.setParameter("id", c21Id);
    List<Child21> r2 = (List<Child21>)q.getResultList();
    Assert.assertEquals(1, r2.size());
    c21 = r2.get(0);
    Assert.assertEquals(c21Id, c21.getId());
    Assert.assertEquals("Child21", c21.getParentStr());
    Assert.assertEquals(21L, c21.getChild21Long());
    startEnd.end();
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.SingleTableInheritanceJPA.Child21

    Long c12Id = c12.getId();
   
    Parent p = newParent(startEnd, "C");
    Long pId = p.getId();

    Child21 c21 = newChild21(startEnd, "D", 121L);
    Long c21Id = c21.getId();

    Child22 c22 = newChild22(startEnd, "E", "Child22", Boolean.TRUE, null);
    Long c22Id = c22.getId();
   
    Assert.assertEquals(5, countForKind(PARENT_KIND));
   
    if (em.isOpen()) {
      em.close();
    }
    em = emf.createEntityManager();
   
    startEnd.start();
    Query q = em.createQuery("select p from " + Parent.class.getName() + " p order by parentStr desc");
    List<Parent> r = (List<Parent>)q.getResultList();
    Assert.assertEquals(5, r.size());

    c22 = (Child22)r.get(0);
    Assert.assertEquals(c22Id, c22.getId());
    Assert.assertEquals("E", c22.getParentStr());
    Assert.assertEquals("Child22", c22.getChild22Str());
    Assert.assertEquals(Boolean.TRUE, c22.getValue());

    c21 = (Child21)r.get(1);
    Assert.assertEquals(c21Id, c21.getId());
    Assert.assertEquals("D", c21.getParentStr());
    Assert.assertEquals(121L, c21.getChild21Long());

    p = r.get(2);
    Assert.assertEquals(pId, p.getId());
    Assert.assertEquals("C", p.getParentStr());
   
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.SingleTableInheritanceJPA.Child21

    makePersistent(c12, startEnd);
    return c12;
  }
 
  private Child21 newChild21(StartEnd startEnd, String parentStr, Long child21Long) {
    Child21 c21 = new Child21();
    c21.setParentStr(parentStr);
    c21.setChild21Long(child21Long);
    makePersistent(c21, startEnd);
    return c21;
  }
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.