@@ -0,0 +1,1465 @@
+package org.querybyexample.jpa;%0A%0Aimport static com.google.common.collect.Lists.newArrayList;%0A%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport javax.persistence.metamodel.Attribute;%0A%0Aimport com.google.common.base.Splitter;%0Aimport com.google.common.collect.Maps;%0A%0Apublic class MetamodelUtil %7B%0A%0A    private static Map%3CClass%3C?%3E, Class%3C?%3E%3E metamodelCache = Maps.newHashMap();%0A%0A    public static List%3CAttribute%3C?, ?%3E%3E toMetamodelListAttributes(String path, Class%3C?%3E from) %7B%0A        try %7B%0A            List%3CAttribute%3C?, ?%3E%3E attributes = newArrayList();%0A            Class%3C?%3E current = from;%0A            for (String pathItem : Splitter.on(%22.%22).split(path)) %7B%0A                System.out.println(pathItem);%0A                Class%3C?%3E metamodelClass = getClazz(current);%0A                Attribute%3C?, ?%3E attribute = (Attribute%3C?, ?%3E) metamodelClass.getField(pathItem).get(null);%0A                attributes.add(attribute);%0A                current = attribute.getJavaType();%0A            %7D%0A            return attributes;%0A        %7D catch (Exception e) %7B%0A            throw new IllegalStateException(e);%0A        %7D%0A    %7D%0A%0A    private static Class%3C?%3E getClazz(Class%3C?%3E current) throws ClassNotFoundException %7B%0A        if (metamodelCache.containsKey(current)) %7B%0A            return metamodelCache.get(current);%0A        %7D%0A        Class%3C?%3E metamodelClass = Class.forName(current.getName() + %22_%22);%0A        metamodelCache.put(current, metamodelClass);%0A        return metamodelClass;%0A    %7D%0A%7D

introduce metamodel util from @speralta