Example usage for javax.persistence.metamodel SetAttribute getName

List of usage examples for javax.persistence.metamodel SetAttribute getName

Introduction

In this page you can find the example usage for javax.persistence.metamodel SetAttribute getName.

Prototype

String getName();

Source Link

Document

Return the name of the attribute.

Usage

From source file:org.batoo.jpa.core.impl.criteria.join.AbstractFrom.java

/**
 * {@inheritDoc}//from  w w w  .j  a v  a2s  .c om
 * 
 */
@Override
@SuppressWarnings("unchecked")
public <Y> SetJoinImpl<X, Y> join(SetAttribute<? super X, Y> set, JoinType jt) {
    return (SetJoinImpl<X, Y>) this.join(set.getName(), jt);
}

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

/**
 * Creates a set join with the next entity.
 * /* w  w  w  .  j  a  va2  s. co m*/
 * @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;
}