示例#1
0
  public RoleResponseEntity findRoleById(FindByRoleIdRequest findRoleByIdRequest) {
    Query q = em.createNamedQuery("RoleEntity.findRoleById");
    q.setParameter(1, findRoleByIdRequest.getId());
    RoleEntity re = (RoleEntity) q.getSingleResult();

    return new RoleResponseEntity(DBUtils.RoleEntityToRoleDto(re));
  }
示例#2
0
  public RoleListResponse findAllRoles() {
    Query q = em.createNamedQuery("RoleEntity.findAll");
    List<RoleEntity> roles = q.getResultList();

    List<RoleDTO> rolesDtoList = new ArrayList<RoleDTO>(roles.size());
    for (RoleEntity re : roles) {
      rolesDtoList.add(DBUtils.RoleEntityToRoleDto(re));
    }
    System.out.println("size: " + rolesDtoList.size());
    return new RoleListResponse(rolesDtoList);
  }