code: @SuppressWarnings("unchecked")
      public <E, F> Path<F> getPath(Root<E> root, List<Attribute<?, ?>> attributes) {
          Path<?> path = root;
          for (Attribute<?, ?> attribute : attributes) {
              boolean found = false;
              if (path instanceof FetchParent) {
                  for (Fetch<E, ?> fetch : ((FetchParent<?, E>) path).getFetches()) {
                      if (attribute.getName().equals(fetch.getAttribute().getName()) && (fetch instanceof Join<?, ?>)) {
                          path = (Join<E, ?>) fetch;
                          found = true;
                          break;
                      }
                  }
              }
              if (!found) {
                  if (attribute instanceof PluralAttribute) {
                      path = ((From<?, ?>) path).join(attribute.getName(), JoinType.LEFT);
                  } else {
                      path = path.get(attribute.getName());
                  }
              }
          }
          return (Path<F>) path;
      }
docs: /*
  Convert the passed propertyPath into a JPA path.
  <p>
  Note: JPA will do joins if the property is in an associated entity.