assertEquals(KeyFactory.stringToKey(pojo.getId()), e.getKey().getParent());
}
public void testSerializeWithOneToMany_AddGrandchildToUnidirectionalDetached() throws Exception {
beginTxn();
HasGrandchildJPA hasGrandchild = new HasGrandchildJPA();
HasOneToManySetJPA pojo = new HasOneToManySetJPA();
hasGrandchild.getYar().add(pojo);
pojo.setVal("yar");
Book b = new Book();
b.setAuthor("harry");
pojo.getBooks().add(b);
em.persist(hasGrandchild);
commitTxn();
em.close();
em = emf.createEntityManager();
hasGrandchild = toBytesAndBack(hasGrandchild);
pojo = hasGrandchild.getYar().iterator().next();
assertEquals("yar", pojo.getVal());
assertEquals(1, pojo.getBooks().size());
Book b2 = new Book();
b2.setAuthor("yar3");
pojo.getBooks().add(b2);