@Override public Predicate buildPredicate(CriteriaBuilder builder, FieldPathBuilder fieldPathBuilder, From root, String ceilingEntity, String fullPropertyName, Path explicitPath, List directValues) { root.fetch("defaultSku", JoinType.LEFT); root.fetch("defaultCategory", JoinType.LEFT); return null; } })
protected Select<T> fetch(JoinType type, Runnable joinCondition) { Interceptor.setInterceptorHandler(where.getTemplate(), frame -> { PropertyDescriptor desc = Reflection.propertyDescriptor(frame.getMethod()); String property = desc.getName(); if (frame.getMethod().equals(desc.getReadMethod())) { getFrom().fetch(property, type); } else { throw new UnsupportedOperationException(GETTER_MSG); } return null; }); joinCondition.run(); Interceptor.setInterceptorHandler(where.getTemplate(), where); return this; }
|| attribute.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE ) { from.fetch(selectedField.getName());
/** * Copy Joins * * @param from source Join * @param to destination Join */ public static void copyJoins(From<?, ?> from, From<?, ?> to) { for (Join<?, ?> j : from.getJoins()) { Join<?, ?> toJoin = to.join(j.getAttribute().getName(), j.getJoinType()); toJoin.alias(getOrCreateAlias(j)); copyJoins(j, toJoin); } for (Fetch<?, ?> f : from.getFetches()) { Fetch<?, ?> toFetch = to.fetch(f.getAttribute().getName()); copyFetches(f, toFetch); } }