Search in sources :

Example 1 with CollectionReturnImpl

use of org.hibernate.loader.plan.build.internal.returns.CollectionReturnImpl in project hibernate-orm by hibernate.

the class AbstractLoadPlanBuildingAssociationVisitationStrategy method startingCollection.

@Override
public void startingCollection(CollectionDefinition collectionDefinition) {
    // see if the EntityDefinition is a root...
    final boolean isRoot = fetchSourceStack.isEmpty();
    if (!isRoot) {
        // if not, this call should represent a fetch which should have been handled in #startingAttribute
        return;
    }
    log.tracef("%s Starting root collection : %s", StringHelper.repeat(">>", fetchSourceStack.size()), collectionDefinition.getCollectionPersister().getRole());
    // if we get here, it is a root
    if (!supportsRootCollectionReturns()) {
        throw new HibernateException("This strategy does not support root collection returns");
    }
    final CollectionReturn collectionReturn = new CollectionReturnImpl(collectionDefinition, querySpaces);
    pushToCollectionStack(collectionReturn);
    addRootReturn(collectionReturn);
    associationKeyRegistered(new AssociationKey(((Joinable) collectionDefinition.getCollectionPersister()).getTableName(), ((Joinable) collectionDefinition.getCollectionPersister()).getKeyColumnNames()));
}
Also used : AssociationKey(org.hibernate.persister.walking.spi.AssociationKey) HibernateException(org.hibernate.HibernateException) CollectionReturn(org.hibernate.loader.plan.spi.CollectionReturn) Joinable(org.hibernate.persister.entity.Joinable) CollectionReturnImpl(org.hibernate.loader.plan.build.internal.returns.CollectionReturnImpl)

Aggregations

HibernateException (org.hibernate.HibernateException)1 CollectionReturnImpl (org.hibernate.loader.plan.build.internal.returns.CollectionReturnImpl)1 CollectionReturn (org.hibernate.loader.plan.spi.CollectionReturn)1 Joinable (org.hibernate.persister.entity.Joinable)1 AssociationKey (org.hibernate.persister.walking.spi.AssociationKey)1