Examples of FetchStrategy


Examples of org.hibernate.engine.FetchStrategy

      if ( attributeNode.getAttribute().isCollection() ) {
        return new CollectionFetch(
            (SessionFactoryImplementor) attributeNode.entityManagerFactory().getSessionFactory(),
            LockMode.NONE,
            fetchOwner,
            new FetchStrategy( FetchTiming.IMMEDIATE, FetchStyle.SELECT ),
            attributeNode.getAttributeName()
        );
      }
      else {
        return new EntityFetch(
            (SessionFactoryImplementor) attributeNode.entityManagerFactory().getSessionFactory(),
            LockMode.NONE,
            fetchOwner,
            attributeNode.getAttributeName(),
            new FetchStrategy( FetchTiming.IMMEDIATE, FetchStyle.SELECT )
        );
      }
    }
    else {
      return new CompositeFetch(
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

    );
    if ( style == null ) {
      style = determineFetchStyleByMetadata( getFetchMode(), getType() );
    }

    return new FetchStrategy( determineFetchTiming( style ), style );
  }
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

    return fetchedAssociationKeySourceMap.get( associationKey );
  }

  @Override
  public void foundCircularAssociation(AssociationAttributeDefinition attributeDefinition) {
    final FetchStrategy fetchStrategy = determineFetchStrategy( attributeDefinition );
    if ( fetchStrategy.getStyle() != FetchStyle.JOIN ) {
      return; // nothing to do
    }

    final AssociationKey associationKey = attributeDefinition.getAssociationKey();
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

    return true;
  }

  protected boolean handleAssociationAttribute(AssociationAttributeDefinition attributeDefinition) {
    // todo : this seems to not be correct for one-to-one
    final FetchStrategy fetchStrategy = determineFetchStrategy( attributeDefinition );
    if ( fetchStrategy.getTiming() != FetchTiming.IMMEDIATE ) {
      return false;
    }

    final ExpandingFetchSource currentSource = currentSource();
    currentSource.validateFetchPlan( fetchStrategy, attributeDefinition );

    final AssociationAttributeDefinition.AssociationNature nature = attributeDefinition.getAssociationNature();
    if ( nature == AssociationAttributeDefinition.AssociationNature.ANY ) {
      // for ANY mappings we need to build a Fetch:
      //    1) fetch type is SELECT
      //    2) (because the fetch cannot be a JOIN...) do not push it to the stack
      currentSource.buildAnyAttributeFetch(
          attributeDefinition,
          fetchStrategy
      );
      return false;
    }
    else if ( nature == AssociationAttributeDefinition.AssociationNature.ENTITY ) {
      EntityFetch fetch = currentSource.buildEntityAttributeFetch(
          attributeDefinition,
          fetchStrategy
      );
      if ( fetchStrategy.getStyle() == FetchStyle.JOIN ) {
        pushToStack( (ExpandingFetchSource) fetch );
        return true;
      }
      else {
        return false;
      }
    }
    else {
      // Collection
      CollectionAttributeFetch fetch = currentSource.buildCollectionAttributeFetch( attributeDefinition, fetchStrategy );
      if ( fetchStrategy.getStyle() == FetchStyle.JOIN ) {
        pushToCollectionStack( fetch );
        return true;
      }
      else {
        return false;
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

  }

  @Override
  protected FetchStrategy resolveImplicitFetchStrategyFromEntityGraph(
      final AssociationAttributeDefinition attributeDefinition) {
    FetchStrategy fetchStrategy = attributeDefinition.determineFetchPlan(
        loadQueryInfluencers,
        currentPropertyPath
    );
    if ( fetchStrategy.getTiming() == FetchTiming.IMMEDIATE && fetchStrategy.getStyle() == FetchStyle.JOIN ) {
      // see if we need to alter the join fetch to another form for any reason
      fetchStrategy = adjustJoinFetchIfNeeded( attributeDefinition, fetchStrategy );
    }

    return fetchStrategy;
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

    }
  }

  @Override
  protected FetchStrategy determineFetchStrategy(AssociationAttributeDefinition attributeDefinition) {
    FetchStrategy fetchStrategy = attributeDefinition.determineFetchPlan( loadQueryInfluencers, currentPropertyPath );
    if ( fetchStrategy.getTiming() == FetchTiming.IMMEDIATE && fetchStrategy.getStyle() == FetchStyle.JOIN ) {
      // see if we need to alter the join fetch to another form for any reason
      fetchStrategy = adjustJoinFetchIfNeeded( attributeDefinition, fetchStrategy );
    }
    return fetchStrategy;
  }
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

   */
  protected FetchStrategy adjustJoinFetchIfNeeded(
      AssociationAttributeDefinition attributeDefinition,
      FetchStrategy fetchStrategy) {
    if ( lockMode.greaterThan( LockMode.READ ) ) {
      return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT );
    }

    final Integer maxFetchDepth = sessionFactory().getSettings().getMaximumFetchDepth();
    if ( maxFetchDepth != null && currentDepth() > maxFetchDepth ) {
      return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT );
    }

    if ( attributeDefinition.getType().isCollectionType() && isTooManyCollections() ) {
      // todo : have this revert to batch or subselect fetching once "sql gen redesign" is in place
      return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT );
    }

    return fetchStrategy;
  }
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

      if ( attributeNode.getAttribute().isCollection() ) {
        return new CollectionFetch(
            (SessionFactoryImplementor) attributeNode.entityManagerFactory().getSessionFactory(),
            LockMode.NONE,
            fetchOwner,
            new FetchStrategy( FetchTiming.IMMEDIATE, FetchStyle.SELECT ),
            attributeNode.getAttributeName()
        );
      }
      else {
        return new EntityFetch(
            (SessionFactoryImplementor) attributeNode.entityManagerFactory().getSessionFactory(),
            LockMode.NONE,
            fetchOwner,
            attributeNode.getAttributeName(),
            new FetchStrategy( FetchTiming.IMMEDIATE, FetchStyle.SELECT )
        );
      }
    }
    else {
      return new CompositeFetch(
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

      final AssociationAttributeDefinition attributeDefinition);

  protected FetchStrategy adjustJoinFetchIfNeeded(
      AssociationAttributeDefinition attributeDefinition, FetchStrategy fetchStrategy) {
    if ( lockMode.greaterThan( LockMode.READ ) ) {
      return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT );
    }

    final Integer maxFetchDepth = sessionFactory().getSettings().getMaximumFetchDepth();
    if ( maxFetchDepth != null && currentDepth() > maxFetchDepth ) {
      return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT );
    }

    if ( attributeDefinition.getType().isCollectionType() && isTooManyCollections() ) {
      // todo : have this revert to batch or subselect fetching once "sql gen redesign" is in place
      return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT );
    }

    return fetchStrategy;
  }
View Full Code Here

Examples of org.hibernate.engine.FetchStrategy

    }
  };

  @Override
  public void foundCircularAssociation(AssociationAttributeDefinition attributeDefinition) {
    final FetchStrategy fetchStrategy = determineFetchStrategy( attributeDefinition );
    if ( fetchStrategy.getStyle() != FetchStyle.JOIN ) {
      return; // nothing to do
    }

    // Bi-directional association & the owning side was already visited.  If the current attribute node refers
    // to it, fetch.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.