Package org.hibernate.engine.profile

Examples of org.hibernate.engine.profile.FetchProfile


        ? fullPath.substring( pos )
        : rootPropertyName;
    String fetchRole = persister.getEntityName() + "." + relativePropertyPath;

    for ( String profileName : getLoadQueryInfluencers().getEnabledFetchProfileNames() ) {
      final FetchProfile profile = getFactory().getFetchProfile( profileName );
      final Fetch fetch = profile.getFetchByRole( fetchRole );
      if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) {
        return true;
      }
    }
    return false;
View Full Code Here


    this.fetchProfiles = new HashMap();
    itr = cfg.iterateFetchProfiles();
    while ( itr.hasNext() ) {
      final org.hibernate.mapping.FetchProfile mappingProfile =
          ( org.hibernate.mapping.FetchProfile ) itr.next();
      final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() );
      for ( org.hibernate.mapping.FetchProfile.Fetch mappingFetch : mappingProfile.getFetches() ) {
        // resolve the persister owning the fetch
        final String entityName = getImportedClassName( mappingFetch.getEntity() );
        final EntityPersister owner = entityName == null
            ? null
            : entityPersisters.get( entityName );
        if ( owner == null ) {
          throw new HibernateException(
              "Unable to resolve entity reference [" + mappingFetch.getEntity()
                  + "] in fetch profile [" + fetchProfile.getName() + "]"
          );
        }

        // validate the specified association fetch
        Type associationType = owner.getPropertyType( mappingFetch.getAssociation() );
        if ( associationType == null || !associationType.isAssociationType() ) {
          throw new HibernateException( "Fetch profile [" + fetchProfile.getName() + "] specified an invalid association" );
        }

        // resolve the style
        final Fetch.Style fetchStyle = Fetch.Style.parse( mappingFetch.getStyle() );

        // then construct the fetch instance...
        fetchProfile.addFetch( new Association( owner, mappingFetch.getAssociation() ), fetchStyle );
        ((Loadable) owner).registerAffectingFetchProfile( fetchProfile.getName() );
      }
      fetchProfiles.put( fetchProfile.getName(), fetchProfile );
    }

    this.customEntityDirtinessStrategy = determineCustomEntityDirtinessStrategy();
    this.currentTenantIdentifierResolver = determineCurrentTenantIdentifierResolver( cfg.getCurrentTenantIdentifierResolver() );
    this.transactionEnvironment = new TransactionEnvironmentImpl( this );
View Full Code Here

    }

    // this needs to happen after persisters are all ready to go...
    this.fetchProfiles = new HashMap<String,FetchProfile>();
    for ( org.hibernate.metamodel.binding.FetchProfile mappingProfile : metadata.getFetchProfiles() ) {
      final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() );
      for ( org.hibernate.metamodel.binding.FetchProfile.Fetch mappingFetch : mappingProfile.getFetches() ) {
        // resolve the persister owning the fetch
        final String entityName = getImportedClassName( mappingFetch.getEntity() );
        final EntityPersister owner = entityName == null ? null : entityPersisters.get( entityName );
        if ( owner == null ) {
          throw new HibernateException(
              "Unable to resolve entity reference [" + mappingFetch.getEntity()
                  + "] in fetch profile [" + fetchProfile.getName() + "]"
          );
        }

        // validate the specified association fetch
        Type associationType = owner.getPropertyType( mappingFetch.getAssociation() );
        if ( associationType == null || ! associationType.isAssociationType() ) {
          throw new HibernateException( "Fetch profile [" + fetchProfile.getName() + "] specified an invalid association" );
        }

        // resolve the style
        final Fetch.Style fetchStyle = Fetch.Style.parse( mappingFetch.getStyle() );

        // then construct the fetch instance...
        fetchProfile.addFetch( new Association( owner, mappingFetch.getAssociation() ), fetchStyle );
        ( ( Loadable ) owner ).registerAffectingFetchProfile( fetchProfile.getName() );
      }
      fetchProfiles.put( fetchProfile.getName(), fetchProfile );
    }

    this.customEntityDirtinessStrategy = determineCustomEntityDirtinessStrategy();
    this.currentTenantIdentifierResolver = determineCurrentTenantIdentifierResolver( null );
    this.transactionEnvironment = new TransactionEnvironmentImpl( this );
View Full Code Here

        ? fullPath.substring( pos )
        : rootPropertyName;
    final String fetchRole = persister.getEntityName() + "." + relativePropertyPath;

    for ( String profileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) {
      final FetchProfile profile = loadQueryInfluencers.getSessionFactory().getFetchProfile( profileName );
      final Fetch fetch = profile.getFetchByRole( fetchRole );
      if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) {
        return FetchStyle.JOIN;
      }
    }
    return null;
View Full Code Here

    String fetchRole = persister.getEntityName() + "." + relativePropertyPath;

    Iterator profiles = getLoadQueryInfluencers().getEnabledFetchProfileNames().iterator();
    while ( profiles.hasNext() ) {
      final String profileName = ( String ) profiles.next();
      final FetchProfile profile = getFactory().getFetchProfile( profileName );
      final Fetch fetch = profile.getFetchByRole( fetchRole );
      if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) {
        return true;
      }
    }
    return false;
View Full Code Here

    this.fetchProfiles = new HashMap();
    itr = cfg.iterateFetchProfiles();
    while ( itr.hasNext() ) {
      final org.hibernate.mapping.FetchProfile mappingProfile =
          ( org.hibernate.mapping.FetchProfile ) itr.next();
      final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() );
      Iterator fetches = mappingProfile.getFetches().iterator();
      while ( fetches.hasNext() ) {
        final org.hibernate.mapping.FetchProfile.Fetch mappingFetch =
            ( org.hibernate.mapping.FetchProfile.Fetch ) fetches.next();
        // resolve the persister owning the fetch
        final String entityName = getImportedClassName( mappingFetch.getEntity() );
        final EntityPersister owner = ( EntityPersister ) ( entityName == null ? null : entityPersisters.get( entityName ) );
        if ( owner == null ) {
          throw new HibernateException(
              "Unable to resolve entity reference [" + mappingFetch.getEntity()
                  + "] in fetch profile [" + fetchProfile.getName() + "]"
          );
        }

        // validate the specified association fetch
        Type associationType = owner.getPropertyType( mappingFetch.getAssociation() );
        if ( associationType == null || !associationType.isAssociationType() ) {
          throw new HibernateException( "Fetch profile [" + fetchProfile.getName() + "] specified an invalid association" );
        }

        // resolve the style
        final Fetch.Style fetchStyle = Fetch.Style.parse( mappingFetch.getStyle() );

        // then construct the fetch instance...
        fetchProfile.addFetch( new Association( owner, mappingFetch.getAssociation() ), fetchStyle );
        ( ( Loadable ) owner ).registerAffectingFetchProfile( fetchProfile.getName() );
      }
      fetchProfiles.put( fetchProfile.getName(), fetchProfile );
    }

    this.transactionEnvironment = new TransactionEnvironmentImpl( this );
    this.observer.sessionFactoryCreated( this );
  }
View Full Code Here

    }

    // this needs to happen after persisters are all ready to go...
    this.fetchProfiles = new HashMap<String,FetchProfile>();
    for ( org.hibernate.metamodel.binding.FetchProfile mappingProfile : metadata.getFetchProfiles() ) {
      final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() );
      for ( org.hibernate.metamodel.binding.FetchProfile.Fetch mappingFetch : mappingProfile.getFetches() ) {
        // resolve the persister owning the fetch
        final String entityName = getImportedClassName( mappingFetch.getEntity() );
        final EntityPersister owner = ( EntityPersister ) ( entityName == null ? null : entityPersisters.get( entityName ) );
        if ( owner == null ) {
          throw new HibernateException(
              "Unable to resolve entity reference [" + mappingFetch.getEntity()
                  + "] in fetch profile [" + fetchProfile.getName() + "]"
          );
        }

        // validate the specified association fetch
        Type associationType = owner.getPropertyType( mappingFetch.getAssociation() );
        if ( associationType == null || ! associationType.isAssociationType() ) {
          throw new HibernateException( "Fetch profile [" + fetchProfile.getName() + "] specified an invalid association" );
        }

        // resolve the style
        final Fetch.Style fetchStyle = Fetch.Style.parse( mappingFetch.getStyle() );

        // then construct the fetch instance...
        fetchProfile.addFetch( new Association( owner, mappingFetch.getAssociation() ), fetchStyle );
        ( ( Loadable ) owner ).registerAffectingFetchProfile( fetchProfile.getName() );
      }
      fetchProfiles.put( fetchProfile.getName(), fetchProfile );
    }

    this.transactionEnvironment = new TransactionEnvironmentImpl( this );
    this.observer.sessionFactoryCreated( this );
  }
View Full Code Here

    this.fetchProfiles = new HashMap();
    itr = cfg.iterateFetchProfiles();
    while ( itr.hasNext() ) {
      final org.hibernate.mapping.FetchProfile mappingProfile =
          ( org.hibernate.mapping.FetchProfile ) itr.next();
      final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() );
      for ( org.hibernate.mapping.FetchProfile.Fetch mappingFetch : mappingProfile.getFetches() ) {
        // resolve the persister owning the fetch
        final String entityName = getImportedClassName( mappingFetch.getEntity() );
        final EntityPersister owner = entityName == null
            ? null
            : entityPersisters.get( entityName );
        if ( owner == null ) {
          throw new HibernateException(
              "Unable to resolve entity reference [" + mappingFetch.getEntity()
                  + "] in fetch profile [" + fetchProfile.getName() + "]"
          );
        }

        // validate the specified association fetch
        Type associationType = owner.getPropertyType( mappingFetch.getAssociation() );
        if ( associationType == null || !associationType.isAssociationType() ) {
          throw new HibernateException( "Fetch profile [" + fetchProfile.getName() + "] specified an invalid association" );
        }

        // resolve the style
        final Fetch.Style fetchStyle = Fetch.Style.parse( mappingFetch.getStyle() );

        // then construct the fetch instance...
        fetchProfile.addFetch( new Association( owner, mappingFetch.getAssociation() ), fetchStyle );
        ((Loadable) owner).registerAffectingFetchProfile( fetchProfile.getName() );
      }
      fetchProfiles.put( fetchProfile.getName(), fetchProfile );
    }

    this.customEntityDirtinessStrategy = determineCustomEntityDirtinessStrategy( properties );
    this.currentTenantIdentifierResolver = determineCurrentTenantIdentifierResolver(
        cfg.getCurrentTenantIdentifierResolver(),
View Full Code Here

    }

    // this needs to happen after persisters are all ready to go...
    this.fetchProfiles = new HashMap<String,FetchProfile>();
    for ( org.hibernate.metamodel.binding.FetchProfile mappingProfile : metadata.getFetchProfiles() ) {
      final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() );
      for ( org.hibernate.metamodel.binding.FetchProfile.Fetch mappingFetch : mappingProfile.getFetches() ) {
        // resolve the persister owning the fetch
        final String entityName = getImportedClassName( mappingFetch.getEntity() );
        final EntityPersister owner = entityName == null ? null : entityPersisters.get( entityName );
        if ( owner == null ) {
          throw new HibernateException(
              "Unable to resolve entity reference [" + mappingFetch.getEntity()
                  + "] in fetch profile [" + fetchProfile.getName() + "]"
          );
        }

        // validate the specified association fetch
        Type associationType = owner.getPropertyType( mappingFetch.getAssociation() );
        if ( associationType == null || ! associationType.isAssociationType() ) {
          throw new HibernateException( "Fetch profile [" + fetchProfile.getName() + "] specified an invalid association" );
        }

        // resolve the style
        final Fetch.Style fetchStyle = Fetch.Style.parse( mappingFetch.getStyle() );

        // then construct the fetch instance...
        fetchProfile.addFetch( new Association( owner, mappingFetch.getAssociation() ), fetchStyle );
        ( ( Loadable ) owner ).registerAffectingFetchProfile( fetchProfile.getName() );
      }
      fetchProfiles.put( fetchProfile.getName(), fetchProfile );
    }

    this.customEntityDirtinessStrategy = determineCustomEntityDirtinessStrategy( properties );
    this.currentTenantIdentifierResolver = determineCurrentTenantIdentifierResolver( null, properties );
    this.transactionEnvironment = new TransactionEnvironmentImpl( this );
View Full Code Here

    this.fetchProfiles = new HashMap();
    itr = cfg.iterateFetchProfiles();
    while ( itr.hasNext() ) {
      final org.hibernate.mapping.FetchProfile mappingProfile =
          ( org.hibernate.mapping.FetchProfile ) itr.next();
      final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() );
      Iterator fetches = mappingProfile.getFetches().iterator();
      while ( fetches.hasNext() ) {
        final org.hibernate.mapping.FetchProfile.Fetch mappingFetch =
            ( org.hibernate.mapping.FetchProfile.Fetch ) fetches.next();
        // resolve the persister owning the fetch
        final String entityName = getImportedClassName( mappingFetch.getEntity() );
        final EntityPersister owner = ( EntityPersister ) ( entityName == null ? null : entityPersisters.get( entityName ) );
        if ( owner == null ) {
          throw new HibernateException(
              "Unable to resolve entity reference [" + mappingFetch.getEntity()
                  + "] in fetch profile [" + fetchProfile.getName() + "]"
          );
        }

        // validate the specified association fetch
        Type associationType = owner.getPropertyType( mappingFetch.getAssociation() );
        if ( associationType == null || !associationType.isAssociationType() ) {
          throw new HibernateException( "Fetch profile [" + fetchProfile.getName() + "] specified an invalid association" );
        }

        // resolve the style
        final Fetch.Style fetchStyle = Fetch.Style.parse( mappingFetch.getStyle() );

        // then construct the fetch instance...
        fetchProfile.addFetch( new Association( owner, mappingFetch.getAssociation() ), fetchStyle );
        ( ( Loadable ) owner ).registerAffectingFetchProfile( fetchProfile.getName() );
      }
      fetchProfiles.put( fetchProfile.getName(), fetchProfile );
    }

    this.observer.sessionFactoryCreated( this );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.engine.profile.FetchProfile

Copyright © 2018 www.massapicom. 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.