コード例 #1
0
 private void initDepartmentManager() {
   Department department =
       entityManager
           .createQuery("Select a From Department a where a.name = 'scala'", Department.class)
           .getSingleResult();
   departmentManagerBean.init(department.getId());
 }
コード例 #2
0
  @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();
  }