Example usage for javax.persistence.criteria From fetch

List of usage examples for javax.persistence.criteria From fetch

Introduction

In this page you can find the example usage for javax.persistence.criteria From fetch.

Prototype

<Y> Fetch<X, Y> fetch(SingularAttribute<? super X, Y> attribute, JoinType jt);

Source Link

Document

Create a fetch join to the specified single-valued attribute using the given join type.

Usage

From source file:org.broadleafcommerce.admin.server.service.handler.ProductCustomPersistenceHandler.java

@Override
public DynamicResultSet fetch(PersistencePackage persistencePackage, CriteriaTransferObject cto,
        DynamicEntityDao dynamicEntityDao, RecordHelper helper) throws ServiceException {
    cto.getNonCountAdditionalFilterMappings()
            .add(new FilterMapping().withDirectFilterValues(new EmptyFilterValues())
                    .withRestriction(new Restriction().withPredicateProvider(new PredicateProvider() {
                        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;
                        }//w w w. j ava 2  s .  c o  m
                    })));
    return helper.getCompatibleModule(OperationType.BASIC).fetch(persistencePackage, cto);
}