ds.put(e3);
beginTxn();
Query q = em.createQuery("select from " + childClass.getName() + " b where aString = :p");
q.setParameter("p", "a2");
Child child = (Child) q.getResultList().get(0);
assertEquals(childClass, child.getClass());
assertEquals("a2", child.getAString());
assertEquals("b2", child.getBString());
q = em.createQuery("select from " + childClass.getName() + " b where bString = :p");
q.setParameter("p", "b2");
child = (Child) q.getSingleResult();
assertEquals(childClass, child.getClass());
assertEquals("a2", child.getAString());
assertEquals("b2", child.getBString());
List<Child> kids = ((List<Child>) em.createQuery(
"select from " + childClass.getName() + " b where aString = 'a2' order by bString desc").getResultList());
assertEquals(3, kids.size());
assertEquals(e2.getKey().getId(), kids.get(0).getId().longValue());