assertEquals(Utils.newArrayList("c", "d", "e"), e.getProperty("strList"));
}
public void testSerializeWithOneToMany_AddChildToBidirectionalDetached() throws Exception {
beginTxn();
HasOneToManyListJPA pojo = new HasOneToManyListJPA();
pojo.setVal("yar");
BidirectionalChildListJPA bidir = new BidirectionalChildListJPA();
bidir.setChildVal("yar2");
pojo.getBidirChildren().add(bidir);
em.persist(pojo);
commitTxn();
em.close();
em = emf.createEntityManager();
pojo = toBytesAndBack(pojo);
assertEquals("yar", pojo.getVal());
assertEquals(1, pojo.getBidirChildren().size());
BidirectionalChildListJPA bidir2 = new BidirectionalChildListJPA();
bidir.setChildVal("yar3");
pojo.getBidirChildren().add(bidir2);
// Don't set the parent - this ref won't get updated when we call
// merge and we'll get an exception.
// bidir2.setParent(pojo);
beginTxn();
pojo = em.merge(pojo);
commitTxn();
Entity e = ds.get(KeyFactory.stringToKey(bidir2.getId()));
assertEquals(KeyFactory.stringToKey(pojo.getId()), e.getKey().getParent());
}