@Test
  @Skip(server = true)
  public void testNestedQuery() {
    JPAEnvironment env = getEnvironment();
    EntityManager em = env.getEntityManager();
    try {
      Address address = new Address();
      address.setCounty(ORANGE);
      address.setState(CA);
      address.setStreet(FELDWEG);
      address.setZipcode(ZIP);
      ContactInfo contactInfo = new ContactInfo();
      contactInfo.setSalutation(SALUTATION);
      contactInfo.setAddress(address);
      Employee employee = new Employee();
      employee.setSsn(6789);
      employee.setName(FRITZ);
      employee.setContactinfo(contactInfo);

      env.beginTransaction(em);
      em.persist(employee);
      env.commitTransactionAndClear(em);

      Query query =
          em.createQuery(
              "select e.name from Employee2 e where e.contactinfo.address.street = :street");
      query.setParameter("street", FELDWEG);
      @SuppressWarnings("unchecked")
      List<String> names = query.getResultList();
      assertEquals(1, names.size());
      assertEquals(FRITZ, names.get(0));
    } finally {
      closeEntityManager(em);
    }
  }
  @Test
  @Skip(server = true)
  public void testNested() {
    JPAEnvironment env = getEnvironment();
    EntityManager em = env.getEntityManager();
    try {
      Address address = new Address();
      address.setCounty(ORANGE);
      address.setState(CA);
      address.setStreet(SUNSET_BVLD);
      address.setZipcode(ZIP);
      ContactInfo contactInfo = new ContactInfo();
      contactInfo.setSalutation(SALUTATION);
      contactInfo.setAddress(address);
      Employee employee = new Employee();
      employee.setSsn(5678);
      employee.setName("Hans");
      employee.setContactinfo(contactInfo);

      env.beginTransaction(em);
      em.persist(employee);
      env.commitTransactionAndClear(em);

      env.beginTransaction(em);
      Employee employee2 = em.find(Employee.class, 5678);
      assertNotNull(employee2);

      ContactInfo contactInfo2 = employee2.getContactinfo();
      assertNotNull(contactInfo2);
      assertEquals(SALUTATION, contactInfo2.getSalutation());

      Address address2 = contactInfo2.getAddress();
      assertNotNull(address2);
      Assert.assertEquals(ORANGE, address.getCounty());
      Assert.assertEquals(CA, address.getState());
      Assert.assertEquals(ZIP, address.getZipcode());
      Assert.assertEquals(SUNSET_BVLD, address.getStreet());

      address2.setStreet(HOPP);
      env.commitTransactionAndClear(em);

      Employee employee3 = em.find(Employee.class, 5678);
      assertNotNull(employee3);
      ContactInfo contactInfo3 = employee3.getContactinfo();
      assertNotNull(contactInfo3);
      Address address3 = contactInfo3.getAddress();
      assertNotNull(address3);
      assertEquals(HOPP, address3.getStreet());

    } finally {
      closeEntityManager(em);
    }
  }