}
commitTxn();
}
public void testOneToMany() {
HasDatastoreIdentityParentJDO pojo = new HasDatastoreIdentityParentJDO();
pojo.setName("First Name");
HasDatastoreIdentityChildJDO child1 = new HasDatastoreIdentityChildJDO();
child1.setName("Child 1");
pojo.getChildren().add(child1);
HasDatastoreIdentityChildJDO child2 = new HasDatastoreIdentityChildJDO();
child2.setName("Child 2");
pojo.getChildren().add(child2);
pm.makePersistent(pojo);
Object id = pm.getObjectId(pojo);
pm.evictAll();
HasDatastoreIdentityParentJDO pojo2 = (HasDatastoreIdentityParentJDO)pm.getObjectById(id);
assertNotNull(pojo2);
assertEquals("First Name", pojo2.getName());
Set<HasDatastoreIdentityChildJDO> children = pojo2.getChildren();
assertNotNull(children);
assertEquals(2, children.size());
pm.evictAll();
pojo2 = (HasDatastoreIdentityParentJDO)pm.getObjectById(id);
assertNotNull(pojo2);
assertEquals("First Name", pojo2.getName());
}