@Test
 public void createAwithB() {
   DynamicType simpleTypeA = helper.getType("SimpleA");
   assertNotNull(simpleTypeA);
   DynamicType simpleTypeB = helper.getType("SimpleB");
   assertNotNull(simpleTypeB);
   EntityManager em = emf.createEntityManager();
   assertNotNull(JpaHelper.getServerSession(emf).getDescriptorForAlias("SimpleB"));
   DynamicEntity simpleInstanceB = simpleTypeB.newDynamicEntity();
   simpleInstanceB.set("id", 1);
   simpleInstanceB.set("value1", "B2");
   DynamicEntity simpleInstanceA = simpleTypeA.newDynamicEntity();
   simpleInstanceA.set("id", 1);
   simpleInstanceA.set("value1", "A2");
   simpleInstanceA.<Collection<DynamicEntity>>get("b").add(simpleInstanceB);
   simpleInstanceB.set("a", simpleInstanceA);
   em.getTransaction().begin();
   em.persist(simpleInstanceB);
   em.persist(simpleInstanceA);
   em.getTransaction().commit();
   int simpleCountB =
       ((Number) em.createQuery("SELECT COUNT(s) FROM SimpleB s").getSingleResult()).intValue();
   assertEquals(1, simpleCountB);
   int simpleCountA =
       ((Number) em.createQuery("SELECT COUNT(s) FROM SimpleA s").getSingleResult()).intValue();
   assertEquals(1, simpleCountA);
   em.close();
 }
 @Test
 public void createSimpleB() {
   DynamicType simpleTypeB = helper.getType("SimpleB");
   assertNotNull(simpleTypeB);
   EntityManager em = emf.createEntityManager();
   DynamicEntity simpleInstance = simpleTypeB.newDynamicEntity();
   simpleInstance.set("id", 1);
   simpleInstance.set("value1", "B1");
   em.getTransaction().begin();
   em.persist(simpleInstance);
   em.getTransaction().commit();
   int simpleCount =
       ((Number) em.createQuery("SELECT COUNT(s) FROM SimpleB s").getSingleResult()).intValue();
   assertEquals(1, simpleCount);
   em.close();
 }
  @Override
  public DynamicEntity unmarshal(String v) throws Exception {
    DynamicEntity address = jc.newDynamicEntity("mynamespace.Address");

    StringTokenizer tokenizer = new StringTokenizer((String) v, "|");

    String street = tokenizer.nextToken();
    street = street.replace('_', ' ');
    String city = tokenizer.nextToken();
    String state = tokenizer.nextToken();
    String zip = tokenizer.nextToken();

    address.set("street", street);
    address.set("city", city);
    address.set("state", state);
    address.set("zip", zip);

    return address;
  }