// 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);