private void initDepartmentManager() { Department department = entityManager .createQuery("Select a From Department a where a.name = 'scala'", Department.class) .getSingleResult(); departmentManagerBean.init(department.getId()); }
@Path("/link") @GET public String linkEmployees() { Department department = entityManager .createQuery("Select a From Department a where a.name = 'scala'", Department.class) .getSingleResult(); Employee employee = entityManager .createQuery("Select a From Employee a where a.name = 'Captain Nemo'", Employee.class) .getSingleResult(); containerTransactionBean.linkEmployeeToDepartment(employee.getId(), department.getId()); return listEmployees(); }