Search in sources :

Example 1 with CompositePropertyMapping

use of org.hibernate.loader.plan.build.internal.spaces.CompositePropertyMapping 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;
}
Also used : EntityPersister(org.hibernate.persister.entity.EntityPersister) ExpandingCompositeQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingCompositeQuerySpace) EntityType(org.hibernate.type.EntityType) CompositeType(org.hibernate.type.CompositeType) Type(org.hibernate.type.Type) CollectionPersister(org.hibernate.persister.collection.CollectionPersister) CompositePropertyMapping(org.hibernate.loader.plan.build.internal.spaces.CompositePropertyMapping) ExpandingEntityQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace) CompositeType(org.hibernate.type.CompositeType)

Example 2 with CompositePropertyMapping

use of org.hibernate.loader.plan.build.internal.spaces.CompositePropertyMapping 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;
}
Also used : EntityPersister(org.hibernate.persister.entity.EntityPersister) ExpandingCompositeQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingCompositeQuerySpace) EntityType(org.hibernate.type.EntityType) CompositeType(org.hibernate.type.CompositeType) Type(org.hibernate.type.Type) CollectionPersister(org.hibernate.persister.collection.CollectionPersister) CompositePropertyMapping(org.hibernate.loader.plan.build.internal.spaces.CompositePropertyMapping) ExpandingEntityQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace) CompositeType(org.hibernate.type.CompositeType)

Aggregations

CompositePropertyMapping (org.hibernate.loader.plan.build.internal.spaces.CompositePropertyMapping)2 ExpandingCompositeQuerySpace (org.hibernate.loader.plan.build.spi.ExpandingCompositeQuerySpace)2 ExpandingEntityQuerySpace (org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace)2 CollectionPersister (org.hibernate.persister.collection.CollectionPersister)2 EntityPersister (org.hibernate.persister.entity.EntityPersister)2 CompositeType (org.hibernate.type.CompositeType)2 EntityType (org.hibernate.type.EntityType)2 Type (org.hibernate.type.Type)2