Example usage for javax.persistence.criteria Join getJavaType

List of usage examples for javax.persistence.criteria Join getJavaType

Introduction

In this page you can find the example usage for javax.persistence.criteria Join getJavaType.

Prototype

Class<? extends X> getJavaType();

Source Link

Document

Return the Java type of the tuple element.

Usage

From source file:org.jboss.pressgang.ccms.filter.utils.JPAUtils.java

/**
 * Find Joined Root of type clazz//from  ww w .  java2 s  .  c o m
 *
 * @param <T>
 * @param query     the criteria query
 * @param rootClass the root class
 * @param joinClass the join class
 * @return the Join
 */
@SuppressWarnings("unchecked")
public static <T, K> Join<T, K> findJoinedType(Root<T> root, Class<T> rootClass, Class<K> joinClass) {
    Join<T, K> join = null;
    for (Join<T, ?> j : root.getJoins()) {
        if (j.getJavaType().equals(joinClass)) {
            join = (Join<T, K>) j;
        }
    }
    return join;
}