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;
}
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;
}
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;
}
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;
}
Aggregations