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);

Source Link

Document

Create a fetch join to the specified single-valued attribute using an inner join.

Usage

From source file:org.jdal.dao.jpa.JpaUtils.java

/**
 * Copy Joins/*from  www  .  j a v a2s  . c  o m*/
 * @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);

    }
}

From source file:com.zero.dao.impl.BaseDaoImpl.java

private void copyJoins(From<?, ?> from, From<?, ?> to) {
    for (Join<?, ?> join : from.getJoins()) {
        Join<?, ?> toJoin = to.join(join.getAttribute().getName(), join.getJoinType());
        toJoin.alias(getAlias(join));/*from   w  w  w.j  a v  a 2 s. c o m*/
        copyJoins(join, toJoin);
    }
    for (Fetch<?, ?> fetch : from.getFetches()) {
        Fetch<?, ?> toFetch = to.fetch(fetch.getAttribute().getName());
        copyFetches(fetch, toFetch);
    }
}