final ReferencingPolyTypesEntity referencingPolyTypesEntity = factory.newPolyTestClass();
referencingPolyTypesEntity.setString("polyTestClassString");
// Setup self-referencing collection
final SelfReferencingEntity polySelfRefClassParent = factory.newPolySelfRefClass();
polySelfRefClassParent.setString("Parent");
final SelfReferencingEntity polySelfRefClassChild1 = factory.newPolySelfRefClass();
polySelfRefClassChild1.setString(CHILD_1);
polySelfRefClassParent.addToPolySelfRefClasses(polySelfRefClassChild1);
final SelfReferencingEntity polySelfRefClassChild2 = factory.newPolySelfRefClass();
polySelfRefClassChild2.setString("Child 2");
polySelfRefClassParent.addToPolySelfRefClasses(polySelfRefClassChild2);
factory.save(polySelfRefClassChild2);
final SelfReferencingEntity polySelfRefClassChild3 = factory.newPolySelfRefClass();
polySelfRefClassChild3.setString("Child 1 of Child 1");
polySelfRefClassChild1.addToPolySelfRefClasses(polySelfRefClassChild3);
factory.save(polySelfRefClassChild3);
factory.save(polySelfRefClassChild1);