@Nullable
    public static Field getFieldOrNull(Class<?> beanClass, String propertyName) {
        while (beanClass != null && !beanClass.equals(Object.class)) {
            try {
                return beanClass.getDeclaredField(propertyName);
            } catch (SecurityException | NoSuchFieldException e) {
                // skip
            }
            beanClass = beanClass.getSuperclass();
        }
        return null;
    }
ReflectionUtils provides Reflection related functionality

@author tiwe
querydsl-core/src/main/java/com/querydsl/core/util/ReflectionUtils.java