public void testEnumInEmbeddedId() { EntityManager em = emf.createEntityManager(); Beneficiary b = new Beneficiary(); b.setId("b8"); List<BeneContact> contacts = new ArrayList<BeneContact>(); BeneContact c = new BeneContact(); c.setEmail("email8"); BeneContactId id = new BeneContactId(); id.setContactType(BeneContactId.ContactType.HOME); c.setBeneficiary(b); c.setId(id); em.persist(c); contacts.add(c); b.setContacts(contacts); em.persist(b); em.getTransaction().begin(); em.flush(); em.getTransaction().commit(); em.clear(); BeneContactId id1 = c.getId(); BeneContact c1 = em.find(BeneContact.class, id1); assertEquals("email8", c1.getEmail()); em.close(); }