// Create a manager and a department
em.getTransaction().begin();
Manager m = new Manager();
m.setId(1);
em.persist(m);
Department dept = new Department();
dept.setId(1);
dept.setDepartmentManager(m);
em.persist(dept);
m.setDepartment(dept);
em.getTransaction().commit();
em.clear();