use of org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace in project hibernate-orm by hibernate.
the class AbstractCollectionReference method buildElementGraph.
private CollectionFetchableElement buildElementGraph() {
final CollectionPersister persister = collectionQuerySpace.getCollectionPersister();
final Type type = persister.getElementType();
if (type.isAssociationType()) {
if (type.isEntityType()) {
final EntityPersister elementPersister = persister.getFactory().getEntityPersister(((EntityType) type).getAssociatedEntityName());
final ExpandingEntityQuerySpace entityQuerySpace = QuerySpaceHelper.INSTANCE.makeEntityQuerySpace(collectionQuerySpace, elementPersister, CollectionPropertyNames.COLLECTION_ELEMENTS, (EntityType) persister.getElementType(), collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(), collectionQuerySpace.canJoinsBeRequired(), allowElementJoin);
return new CollectionFetchableElementEntityGraph(this, entityQuerySpace);
} else if (type.isAnyType()) {
return new CollectionFetchableElementAnyGraph(this);
}
} else if (type.isComponentType()) {
final ExpandingCompositeQuerySpace compositeQuerySpace = QuerySpaceHelper.INSTANCE.makeCompositeQuerySpace(collectionQuerySpace, new CompositePropertyMapping((CompositeType) persister.getElementType(), (PropertyMapping) persister, ""), CollectionPropertyNames.COLLECTION_ELEMENTS, (CompositeType) persister.getElementType(), collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(), collectionQuerySpace.canJoinsBeRequired(), allowElementJoin);
return new CollectionFetchableElementCompositeGraph(this, compositeQuerySpace);
}
return null;
}
use of org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace in project hibernate-orm by hibernate.
the class QuerySpacesImpl method makeRootEntityQuerySpace.
@Override
public ExpandingEntityQuerySpace makeRootEntityQuerySpace(String uid, EntityPersister entityPersister) {
final ExpandingEntityQuerySpace space = makeEntityQuerySpace(uid, entityPersister, true);
roots.add(space);
return space;
}
use of org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace in project hibernate-orm by hibernate.
the class AbstractCollectionReference method buildIndexGraph.
private CollectionFetchableIndex buildIndexGraph() {
final CollectionPersister persister = collectionQuerySpace.getCollectionPersister();
if (persister.hasIndex()) {
final Type type = persister.getIndexType();
if (type.isAssociationType()) {
if (type.isEntityType()) {
final EntityPersister indexPersister = persister.getFactory().getEntityPersister(((EntityType) type).getAssociatedEntityName());
final ExpandingEntityQuerySpace entityQuerySpace = QuerySpaceHelper.INSTANCE.makeEntityQuerySpace(collectionQuerySpace, indexPersister, CollectionPropertyNames.COLLECTION_INDICES, (EntityType) persister.getIndexType(), collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(), collectionQuerySpace.canJoinsBeRequired(), allowIndexJoin);
return new CollectionFetchableIndexEntityGraph(this, entityQuerySpace);
} else if (type.isAnyType()) {
return new CollectionFetchableIndexAnyGraph(this);
}
} else if (type.isComponentType()) {
final ExpandingCompositeQuerySpace compositeQuerySpace = QuerySpaceHelper.INSTANCE.makeCompositeQuerySpace(collectionQuerySpace, new CompositePropertyMapping((CompositeType) persister.getIndexType(), (PropertyMapping) persister, ""), CollectionPropertyNames.COLLECTION_INDICES, (CompositeType) persister.getIndexType(), collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(), collectionQuerySpace.canJoinsBeRequired(), allowIndexJoin);
return new CollectionFetchableIndexCompositeGraph(this, compositeQuerySpace);
}
}
return null;
}
use of org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace in project hibernate-orm by hibernate.
the class AbstractExpandingFetchSource method buildEntityAttributeFetch.
@Override
public EntityFetch buildEntityAttributeFetch(AssociationAttributeDefinition attributeDefinition, FetchStrategy fetchStrategy) {
final ExpandingEntityQuerySpace entityQuerySpace = QuerySpaceHelper.INSTANCE.makeEntityQuerySpace(expandingQuerySpace(), attributeDefinition, getQuerySpaces().generateImplicitUid(), fetchStrategy);
final EntityFetch fetch = new EntityAttributeFetchImpl(this, attributeDefinition, fetchStrategy, entityQuerySpace);
addFetch(fetch);
return fetch;
}
use of org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace in project hibernate-orm by hibernate.
the class QuerySpaceHelper method makeEntityQuerySpace.
public ExpandingEntityQuerySpace makeEntityQuerySpace(ExpandingQuerySpace lhsQuerySpace, EntityPersister fetchedPersister, String attributeName, EntityType attributeType, String querySpaceUid, boolean required, boolean shouldIncludeJoin) {
final ExpandingEntityQuerySpace rhs = lhsQuerySpace.getExpandingQuerySpaces().makeEntityQuerySpace(querySpaceUid, fetchedPersister, required);
if (shouldIncludeJoin) {
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createEntityJoin(lhsQuerySpace, attributeName, rhs, required, attributeType, fetchedPersister.getFactory());
lhsQuerySpace.addJoin(join);
}
return rhs;
}
Aggregations