5657585960616263646566676869707172
d.setId(1); d.setDepartmentName("d1"); d.setDepartmentManager(m); m.setDepartment(d); Employee e1 = new Employee(); e1.setId(2); e1.setFirstName("ef1"); e1.setLastName("el1"); e1.setDepartment(d); e1.setManager(m); e1.setVacationDays(20); em.persist(m); em.persist(d); em.persist(e1); em.getTransaction().commit();
5354555657585960616263
em.getTransaction().commit(); em.clear(); emf.getCache().evictAll(); Employee e = em.find(Employee.class, 1); assertNotNull(e); assertTrue(e instanceof Manager); em.clear(); e = em.find(Employee.class, 1); assertNotNull(e);