Examples of FetchProfile


Examples of org.hibernate.engine.profile.FetchProfile

    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

Examples of org.hibernate.mapping.FetchProfile

    public void addFilterDefinition(FilterDefinition definition) {
      filterDefinitions.put( definition.getFilterName(), definition );
    }

    public FetchProfile findOrCreateFetchProfile(String name, MetadataSource source) {
      FetchProfile profile = fetchProfiles.get( name );
      if ( profile == null ) {
        profile = new FetchProfile( name, source );
        fetchProfiles.put( name, profile );
      }
      return profile;
    }
View Full Code Here

Examples of org.hibernate.mapping.FetchProfile

    public void addFilterDefinition(FilterDefinition definition) {
      filterDefinitions.put( definition.getFilterName(), definition );
    }

    public FetchProfile findOrCreateFetchProfile(String name, MetadataSource source) {
      FetchProfile profile = fetchProfiles.get( name );
      if ( profile == null ) {
        profile = new FetchProfile( name, source );
        fetchProfiles.put( name, profile );
      }
      return profile;
    }
View Full Code Here

Examples of org.hibernate.mapping.FetchProfile

    public void addFilterDefinition(FilterDefinition definition) {
      filterDefinitions.put( definition.getFilterName(), definition );
    }

    public FetchProfile findOrCreateFetchProfile(String name) {
      FetchProfile profile = ( FetchProfile ) fetchProfiles.get( name );
      if ( profile == null ) {
        profile = new FetchProfile( name );
        fetchProfiles.put( name, profile );
      }
      return profile;
    }
View Full Code Here

Examples of org.hibernate.mapping.FetchProfile

    filterable.addFilter(name, condition, autoAliasInjection, aliasTables, null);
  }

  private static void parseFetchProfile(Element element, Mappings mappings, String containingEntityName) {
    String profileName = element.attributeValue( "name" );
    FetchProfile profile = mappings.findOrCreateFetchProfile( profileName, MetadataSource.HBM );
    Iterator itr = element.elementIterator( "fetch" );
    while ( itr.hasNext() ) {
      final Element fetchElement = ( Element ) itr.next();
      final String association = fetchElement.attributeValue( "association" );
      final String style = fetchElement.attributeValue( "style" );
      String entityName = fetchElement.attributeValue( "entity" );
      if ( entityName == null ) {
        entityName = containingEntityName;
      }
      if ( entityName == null ) {
        throw new MappingException( "could not determine entity for fetch-profile fetch [" + profileName + "]:[" + association + "]" );
      }
      profile.addFetch( entityName, association, style );
    }
  }
View Full Code Here

Examples of org.hibernate.mapping.FetchProfile

    public void addFilterDefinition(FilterDefinition definition) {
      filterDefinitions.put( definition.getFilterName(), definition );
    }

    public FetchProfile findOrCreateFetchProfile(String name, MetadataSource source) {
      FetchProfile profile = fetchProfiles.get( name );
      if ( profile == null ) {
        profile = new FetchProfile( name, source );
        fetchProfiles.put( name, profile );
      }
      return profile;
    }
View Full Code Here

Examples of org.hibernate.mapping.FetchProfile

    public void addFilterDefinition(FilterDefinition definition) {
      filterDefinitions.put( definition.getFilterName(), definition );
    }

    public FetchProfile findOrCreateFetchProfile(String name, MetadataSource source) {
      FetchProfile profile = fetchProfiles.get( name );
      if ( profile == null ) {
        profile = new FetchProfile( name, source );
        fetchProfiles.put( name, profile );
      }
      return profile;
    }
View Full Code Here

Examples of org.hibernate.mapping.FetchProfile

    public void addFilterDefinition(FilterDefinition definition) {
      filterDefinitions.put( definition.getFilterName(), definition );
    }

    public FetchProfile findOrCreateFetchProfile(String name, MetadataSource source) {
      FetchProfile profile = fetchProfiles.get( name );
      if ( profile == null ) {
        profile = new FetchProfile( name, source );
        fetchProfiles.put( name, profile );
      }
      return profile;
    }
View Full Code Here

Examples of org.hibernate.mapping.FetchProfile

    filterable.addFilter( name, condition );
  }

  private static void parseFetchProfile(Element element, Mappings mappings, String containingEntityName) {
    String profileName = element.attributeValue( "name" );
    FetchProfile profile = mappings.findOrCreateFetchProfile( profileName, MetadataSource.HBM );
    Iterator itr = element.elementIterator( "fetch" );
    while ( itr.hasNext() ) {
      final Element fetchElement = ( Element ) itr.next();
      final String association = fetchElement.attributeValue( "association" );
      final String style = fetchElement.attributeValue( "style" );
      String entityName = fetchElement.attributeValue( "entity" );
      if ( entityName == null ) {
        entityName = containingEntityName;
      }
      if ( entityName == null ) {
        throw new MappingException( "could not determine entity for fetch-profile fetch [" + profileName + "]:[" + association + "]" );
      }
      profile.addFetch( entityName, association, style );
    }
  }
View Full Code Here

Examples of org.hibernate.mapping.FetchProfile

    filterable.addFilter( name, condition );
  }

  private static void parseFetchProfile(Element element, Mappings mappings, String containingEntityName) {
    String profileName = element.attributeValue( "name" );
    FetchProfile profile = mappings.findOrCreateFetchProfile( profileName );
    Iterator itr = element.elementIterator( "fetch" );
    while ( itr.hasNext() ) {
      final Element fetchElement = ( Element ) itr.next();
      final String association = fetchElement.attributeValue( "association" );
      final String style = fetchElement.attributeValue( "style" );
      String entityName = fetchElement.attributeValue( "entity" );
      if ( entityName == null ) {
        entityName = containingEntityName;
      }
      if ( entityName == null ) {
        throw new MappingException( "could not determine entity for fetch-profile fetch [" + profileName + "]:[" + association + "]" );
      }
      profile.addFetch( entityName, association, style );
    }
  }
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.