public void testSerializeWithOneToMany_AddChildToReattached() throws Exception {
    pm.setDetachAllOnCommit(true);
    beginTxn();
    HasOneToManyListJDO pojo = new HasOneToManyListJDO();
    pojo.setVal("yar");
    BidirectionalChildListJDO bidir = new BidirectionalChildListJDO();
    bidir.setChildVal("yar2");
    pojo.addBidirChild(bidir);
    pm.makePersistent(pojo);
    commitTxn();
    pm.close();
    pm = pmf.getPersistenceManager();

    pojo = toBytesAndBack(pojo);
    assertEquals("yar", pojo.getVal());
    assertEquals(1, pojo.getBidirChildren().size());
    beginTxn();
    pojo = pm.makePersistent(pojo);
    BidirectionalChildListJDO bidir2 = new BidirectionalChildListJDO();
    bidir.setChildVal("yar3");
    pojo.addBidirChild(bidir2);
    bidir2.setParent(pojo);
    commitTxn();
    Entity e = ds.get(KeyFactory.stringToKey(bidir2.getId()));
    assertEquals(KeyFactory.stringToKey(pojo.getId()), e.getKey().getParent());
  }