Example usage for javax.persistence.criteria JoinType toString

List of usage examples for javax.persistence.criteria JoinType toString

Introduction

In this page you can find the example usage for javax.persistence.criteria JoinType toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.easy.criteria.CriteriaComposer.java

/**
 * Creates a set join with the next entity.
 * /*from   w w  w  .ja  v  a  2  s .  com*/
 * @param <R>
 *            - Class of the next entity
 * @param attribute
 *            - SetAttribute of this entity that has reference to next
 *            entity
 * @return Sub criteria for the next entity
 */
@SuppressWarnings("unchecked")
public <V> CriteriaComposer<V> join(JoinType joinType, SetAttribute<? super E, V> attribute,
        CriteriaComposer<V> subCriteria) {
    Preconditions.checkNotNull(attribute);

    Class<V> classToJoin = attribute.getBindableJavaType();

    JoinContainer<E> join = new JoinContainer<E>(joinType, attribute);

    // Dont overwrite join
    if (_joins.containsKey(join))
        return (CriteriaComposer<V>) _joins.get(join);

    if (subCriteria == null)
        subCriteria = new CriteriaComposer<V>(classToJoin);

    _joins.put(join, subCriteria);

    log.debug("Addeding join " + joinType.toString() + " on " + classToJoin.getSimpleName() + " "
            + attribute.getName());

    return subCriteria;
}

From source file:org.easy.criteria.CriteriaComposer.java

/**
 * Creates a singular join with the next entity.
 * //from   w  w w .j a  va  2 s .c o m
 * @param <R>
 *            - The entity type to join with. (right side)
 * @param attribute
 *            - SingularAttribute of this entity that has reference to next
 *            entity
 * @return - Sub criteria for the next entity
 */
@SuppressWarnings("unchecked")
public <V> CriteriaComposer<V> join(JoinType joinType, SingularAttribute<? super E, V> attribute,
        CriteriaComposer<V> subCriteria) {
    Preconditions.checkNotNull(attribute);

    Class<V> classToJoin = attribute.getBindableJavaType();

    JoinContainer<E> join = new JoinContainer<E>(joinType, attribute);

    // Don't overwrite join
    if (_joins.containsKey(join))
        return (CriteriaComposer<V>) _joins.get(join);

    if (subCriteria == null)
        subCriteria = new CriteriaComposer<V>(classToJoin);

    _joins.put(join, subCriteria);

    log.debug("Addeding join " + joinType.toString() + " on " + classToJoin.getSimpleName() + " "
            + attribute.getName());

    return subCriteria;
}