code: public static <T> Root getRoot(AbstractQuery<T> query, Class queryType) {
          Root<?> table = null;
          for( Root<?> root : query.getRoots() ) {
             if( root.getJavaType().equals(queryType) )  {
                 table = root;
                 break;
             }
          }
          return table;
      }
docs: This is a helper method to retrieve a particular {@link Root} from a {@link CriteriaQuery} instance
  
  @param query The {@link CriteriaQuery} instance that we're building
  @param queryType The {@link Class} matching the {@link Root} we want
  @return The {@link Root} matching the given {@link Class} or null if it's not in the query