Search in sources :

Example 1 with ExpandingCollectionQuerySpace

use of org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace in project hibernate-orm by hibernate.

the class AbstractExpandingFetchSource method buildCollectionAttributeFetch.

@Override
public CollectionAttributeFetch buildCollectionAttributeFetch(AssociationAttributeDefinition attributeDefinition, FetchStrategy fetchStrategy) {
    final ExpandingCollectionQuerySpace collectionQuerySpace = QuerySpaceHelper.INSTANCE.makeCollectionQuerySpace(querySpace, attributeDefinition, getQuerySpaces().generateImplicitUid(), fetchStrategy);
    final CollectionAttributeFetch fetch = new CollectionAttributeFetchImpl(this, attributeDefinition, fetchStrategy, collectionQuerySpace);
    addFetch(fetch);
    return fetch;
}
Also used : CollectionAttributeFetch(org.hibernate.loader.plan.spi.CollectionAttributeFetch) ExpandingCollectionQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace)

Example 2 with ExpandingCollectionQuerySpace

use of org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace in project hibernate-orm by hibernate.

the class QuerySpaceHelper method makeCollectionQuerySpace.

public ExpandingCollectionQuerySpace makeCollectionQuerySpace(ExpandingQuerySpace lhsQuerySpace, AssociationAttributeDefinition attributeDefinition, String querySpaceUid, FetchStrategy fetchStrategy) {
    final CollectionType fetchedType = (CollectionType) attributeDefinition.getType();
    final CollectionPersister fetchedPersister = attributeDefinition.toCollectionDefinition().getCollectionPersister();
    if (fetchedPersister == null) {
        throw new WalkingException(String.format("Unable to locate CollectionPersister [%s] for fetch [%s]", fetchedType.getRole(), attributeDefinition.getName()));
    }
    final boolean required = lhsQuerySpace.canJoinsBeRequired() && !attributeDefinition.isNullable();
    final ExpandingCollectionQuerySpace rhs = lhsQuerySpace.getExpandingQuerySpaces().makeCollectionQuerySpace(querySpaceUid, fetchedPersister, required);
    if (shouldIncludeJoin(fetchStrategy)) {
        final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCollectionJoin(lhsQuerySpace, attributeDefinition.getName(), rhs, required, (CollectionType) attributeDefinition.getType(), fetchedPersister.getFactory());
        lhsQuerySpace.addJoin(join);
    }
    return rhs;
}
Also used : CollectionPersister(org.hibernate.persister.collection.CollectionPersister) CollectionType(org.hibernate.type.CollectionType) JoinDefinedByMetadata(org.hibernate.loader.plan.spi.JoinDefinedByMetadata) WalkingException(org.hibernate.persister.walking.spi.WalkingException) ExpandingCollectionQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace)

Example 3 with ExpandingCollectionQuerySpace

use of org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace in project hibernate-orm by hibernate.

the class QuerySpacesImpl method makeRootCollectionQuerySpace.

@Override
public ExpandingCollectionQuerySpace makeRootCollectionQuerySpace(String uid, CollectionPersister collectionPersister) {
    final ExpandingCollectionQuerySpace space = makeCollectionQuerySpace(uid, collectionPersister, true);
    roots.add(space);
    return space;
}
Also used : ExpandingCollectionQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace)

Example 4 with ExpandingCollectionQuerySpace

use of org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace in project hibernate-orm by hibernate.

the class QuerySpacesImpl method makeCollectionQuerySpace.

@Override
public ExpandingCollectionQuerySpace makeCollectionQuerySpace(String uid, CollectionPersister collectionPersister, boolean canJoinsBeRequired) {
    checkQuerySpaceDoesNotExist(uid);
    final ExpandingCollectionQuerySpace space = new CollectionQuerySpaceImpl(collectionPersister, uid, this, canJoinsBeRequired);
    registerQuerySpace(space);
    return space;
}
Also used : ExpandingCollectionQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace)

Aggregations

ExpandingCollectionQuerySpace (org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace)4 CollectionAttributeFetch (org.hibernate.loader.plan.spi.CollectionAttributeFetch)1 JoinDefinedByMetadata (org.hibernate.loader.plan.spi.JoinDefinedByMetadata)1 CollectionPersister (org.hibernate.persister.collection.CollectionPersister)1 WalkingException (org.hibernate.persister.walking.spi.WalkingException)1 CollectionType (org.hibernate.type.CollectionType)1