Search in sources :

Example 1 with CollectionJoin

use of javax.persistence.criteria.CollectionJoin in project hibernate-orm by hibernate.

the class AbstractFromImpl method joinCollection.

@Override
@SuppressWarnings({ "unchecked" })
public <X, Y> CollectionJoin<X, Y> joinCollection(String attributeName, JoinType jt) {
    final Attribute<X, ?> attribute = (Attribute<X, ?>) locateAttribute(attributeName);
    if (!attribute.isCollection()) {
        throw new IllegalArgumentException("Requested attribute was not a collection");
    }
    final PluralAttribute pluralAttribute = (PluralAttribute) attribute;
    if (!PluralAttribute.CollectionType.COLLECTION.equals(pluralAttribute.getCollectionType())) {
        throw new IllegalArgumentException("Requested attribute was not a collection");
    }
    return (CollectionJoin<X, Y>) join((CollectionAttribute) attribute, jt);
}
Also used : CollectionAttribute(javax.persistence.metamodel.CollectionAttribute) CollectionJoin(javax.persistence.criteria.CollectionJoin) CollectionAttribute(javax.persistence.metamodel.CollectionAttribute) MapAttribute(javax.persistence.metamodel.MapAttribute) SingularAttribute(javax.persistence.metamodel.SingularAttribute) Attribute(javax.persistence.metamodel.Attribute) PluralAttribute(javax.persistence.metamodel.PluralAttribute) SetAttribute(javax.persistence.metamodel.SetAttribute) ListAttribute(javax.persistence.metamodel.ListAttribute) PluralAttribute(javax.persistence.metamodel.PluralAttribute)

Aggregations

CollectionJoin (javax.persistence.criteria.CollectionJoin)1 Attribute (javax.persistence.metamodel.Attribute)1 CollectionAttribute (javax.persistence.metamodel.CollectionAttribute)1 ListAttribute (javax.persistence.metamodel.ListAttribute)1 MapAttribute (javax.persistence.metamodel.MapAttribute)1 PluralAttribute (javax.persistence.metamodel.PluralAttribute)1 SetAttribute (javax.persistence.metamodel.SetAttribute)1 SingularAttribute (javax.persistence.metamodel.SingularAttribute)1