factory = Persistence.createEntityManagerFactory("CGLIB");
entityManager = factory.createEntityManager();
entityManager.getTransaction().begin();
SimpleInnerEntity sub = new SimpleInnerEntity();
sub.setName("simple inner entity");
SimpleCollectionEntity col = new SimpleCollectionEntity();
SimpleCollectionEntity col2 = new SimpleCollectionEntity();
Collection<SimpleCollectionEntity> cols = new ArrayList<SimpleCollectionEntity>();
cols.add(col);
cols.add(col2);
SimpleEntity e = new SimpleEntity();
col.setSimpleEntity(e);
col2.setSimpleEntity(e);
sub.setEntity(new ArrayList<SimpleEntity>());
sub.getEntity().add(e);
e.setName("a name");
e.setSimpleCollection(cols);
e.setCglibEntity(sub);