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

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


    Assert.assertEquals(new Integer(11), c11.getChild11Integer());
    Assert.assertTrue(c11.getChild11Manys().isEmpty());
    startEnd.end();

    //  create Child12
    Child11Many c12m = new Child11Many("Child11ManyStr");
    Child12 c12 = newChild12(startEnd, "Child12", null, 112, null, new Embedded1("Child12Embedded1"), c12m);
    Long c12Id = c12.getId();
    String c12mId = c12m.getId();
    Key c12Key = KeyFactory.createKey(PARENT_KIND, c12Id);
   
    //  verify Child12 entity
    Entity c12e = ds.get(c12Key);
    Assert.assertEquals(c12Key, c12e.getKey());
View Full Code Here


    //  add a Child11Many to Child12
    startEnd.start();
    c12_0 = em.find(Child12.class, c12_0Id);
    Assert.assertTrue(c12_0.getChild11Manys().isEmpty());
    Assert.assertEquals("Child12Embedded1(1)",c12_0.getEmbedded1().getStr());
    Child11Many c12m_0 = new Child11Many("Child12Embedded1(1)/Child11ManyStr(1)");
    c12_0.getChild11Manys().add(c12m_0);
    startEnd.end();
    String c12m_0Id = c12m_0.getId();
   
    // more objects to prove we update and delete the correct one
    newChild12(startEnd, "B", null, 121, null, new Embedded1("Child12Embedded1(2)"), new Child11Many("Child12Embedded1(2)/Child11ManyStr(1)"));
   
    Assert.assertEquals(2, countForKind(PARENT_KIND));
    Assert.assertEquals(2, countForClass(Child11Many.class));
   
    //  check the key of  Child11Many in the Entity
    Entity c12e = ds.get(c12_0key);
    Assert.assertEquals(KeyFactory.stringToKey(c12m_0Id), ((List<Key>)c12e.getProperty("child11Manys")).get(0));
   
    //  query the first Child12
    startEnd.start();
    Query q = em.createQuery("select c from " + Child12.class.getName() + " c order by parentStr");
    q.setFirstResult(0);
    q.setMaxResults(1);
    List<Child12> r = (List<Child12>)q.getResultList();
    Assert.assertEquals(1, r.size());
    Assert.assertEquals(c12_0Id, r.get(0).getId());
    Assert.assertEquals("Child12Embedded1(1)", r.get(0).getEmbedded1().getStr());
    Assert.assertEquals("A", c12_0.getParentStr());
    Child11Many c12m_1 = new Child11Many("Child12Embedded1(1)/Child11ManyStr(2)");
    r.get(0).getChild11Manys().add(c12m_1);
    startEnd.end();
    String c12m_1Id = c12m_1.getId();
   
    Assert.assertEquals(2, countForKind(PARENT_KIND));
    Assert.assertEquals(3, countForClass(Child11Many.class));

    c12e = ds.get(c12_0key);
View Full Code Here

  private void testQueryParentAndChildren(StartEnd startEnd) {
    Child11 c11 = newChild11(startEnd, "A", 111);
    Long c11Id = c11.getId();

    Child12 c12 = newChild12(startEnd, "B", 112, 211, 8.15f, new Embedded1("Embedded1"),
  new Child11Many("Child12(2)/Child11Many"));
    Long c12Id = c12.getId();
   
    Parent p = newParent(startEnd, "C");
    Long pId = p.getId();
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.SingleTableInheritanceJPA.Child11Many

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.