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();
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());
c12 = (Child12)r.get(3);
Assert.assertEquals(c12Id, c12.getId());
Assert.assertEquals("B", c12.getParentStr());
Assert.assertEquals(new Integer(112), c12.getChild11Integer());