Examples of BootstrapServiceRegistryBuilder


Examples of org.hibernate.boot.registry.BootstrapServiceRegistryBuilder

  protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
  }

  protected BootstrapServiceRegistry buildBootstrapServiceRegistry() {
    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    prepareBootstrapRegistryBuilder( builder );
    return builder.build();
  }
View Full Code Here

Examples of org.hibernate.boot.registry.BootstrapServiceRegistryBuilder

   * @param integrationSettings Any integration settings passed by the EE container or SE application
   *
   * @return The built BootstrapServiceRegistry
   */
  private BootstrapServiceRegistry buildBootstrapServiceRegistry(Map integrationSettings) {
    final BootstrapServiceRegistryBuilder bootstrapServiceRegistryBuilder = new BootstrapServiceRegistryBuilder();
    bootstrapServiceRegistryBuilder.with( new JpaIntegrator() );

    final IntegratorProvider integratorProvider = (IntegratorProvider) integrationSettings.get( INTEGRATOR_PROVIDER );
    if ( integratorProvider != null ) {
      for ( Integrator integrator : integratorProvider.getIntegrators() ) {
        bootstrapServiceRegistryBuilder.with( integrator );
      }
    }
   
    final StrategyRegistrationProviderList strategyRegistrationProviderList
        = (StrategyRegistrationProviderList) integrationSettings.get( STRATEGY_REGISTRATION_PROVIDERS );
    if ( strategyRegistrationProviderList != null ) {
      for ( StrategyRegistrationProvider strategyRegistrationProvider : strategyRegistrationProviderList
          .getStrategyRegistrationProviders() ) {
        bootstrapServiceRegistryBuilder.withStrategySelectors( strategyRegistrationProvider );
      }
    }

    // TODO: If providedClassLoader is present (OSGi, etc.) *and*
    // an APP_CLASSLOADER is provided, should throw an exception or
    // warn?
    ClassLoader classLoader;
    ClassLoader appClassLoader = (ClassLoader) integrationSettings.get( org.hibernate.cfg.AvailableSettings.APP_CLASSLOADER );
    if ( providedClassLoader != null ) {
      classLoader = providedClassLoader;
    }
    else if ( appClassLoader != null ) {
      classLoader = appClassLoader;
    }
    else {
      classLoader = persistenceUnit.getClassLoader();
    }
    bootstrapServiceRegistryBuilder.with( classLoader );

    return bootstrapServiceRegistryBuilder.build();
  }
View Full Code Here

Examples of org.hibernate.boot.registry.BootstrapServiceRegistryBuilder

   
    Configuration configuration = new Configuration();
    configuration.getProperties().put( AvailableSettings.JTA_PLATFORM, osgiJtaPlatform );
        configuration.configure();
       
        BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
        builder.with( osgiClassLoader );
       
        ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder( builder.build() )
            .applySettings(configuration.getProperties()).build();       
        return configuration.buildSessionFactory(serviceRegistry);
  }
View Full Code Here

Examples of org.hibernate.boot.registry.BootstrapServiceRegistryBuilder

   * @param integrationSettings Any integration settings passed by the EE container or SE application
   *
   * @return The built BootstrapServiceRegistry
   */
  private BootstrapServiceRegistry buildBootstrapServiceRegistry(Map integrationSettings) {
    final BootstrapServiceRegistryBuilder bootstrapServiceRegistryBuilder = new BootstrapServiceRegistryBuilder();
    bootstrapServiceRegistryBuilder.with( new JpaIntegrator() );

    final IntegratorProvider integratorProvider = (IntegratorProvider) integrationSettings.get( INTEGRATOR_PROVIDER );
    if ( integratorProvider != null ) {
      for ( Integrator integrator : integratorProvider.getIntegrators() ) {
        bootstrapServiceRegistryBuilder.with( integrator );
      }
    }
   
    final StrategyRegistrationProviderList strategyRegistrationProviderList
        = (StrategyRegistrationProviderList) integrationSettings.get( STRATEGY_REGISTRATION_PROVIDERS );
    if ( strategyRegistrationProviderList != null ) {
      for ( StrategyRegistrationProvider strategyRegistrationProvider : strategyRegistrationProviderList
          .getStrategyRegistrationProviders() ) {
        bootstrapServiceRegistryBuilder.withStrategySelectors( strategyRegistrationProvider );
      }
    }

    // TODO: If providedClassLoader is present (OSGi, etc.) *and*
    // an APP_CLASSLOADER is provided, should throw an exception or
    // warn?
    ClassLoader classLoader;
    ClassLoader appClassLoader = (ClassLoader) integrationSettings.get( org.hibernate.cfg.AvailableSettings.APP_CLASSLOADER );
    if ( providedClassLoader != null ) {
      classLoader = providedClassLoader;
    }
    else if ( appClassLoader != null ) {
      classLoader = appClassLoader;
    }
    else {
      classLoader = persistenceUnit.getClassLoader();
    }
    bootstrapServiceRegistryBuilder.with( classLoader );

    return bootstrapServiceRegistryBuilder.build();
  }
View Full Code Here

Examples of org.hibernate.boot.registry.BootstrapServiceRegistryBuilder

      }
      String cfgResource = "/" + cfgResources.iterator().next();
      configuration.configure( cfgResource );
    }

    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    builder.with( osgiClassLoader );

    final Integrator[] integrators = OsgiServiceUtil.getServiceImpls( Integrator.class, context );
    for ( Integrator integrator : integrators ) {
      builder.with( integrator );
    }

    final StrategyRegistrationProvider[] strategyRegistrationProviders
        = OsgiServiceUtil.getServiceImpls( StrategyRegistrationProvider.class, context );
    for ( StrategyRegistrationProvider strategyRegistrationProvider : strategyRegistrationProviders ) {
      builder.withStrategySelectors( strategyRegistrationProvider );
    }
       
    final TypeContributor[] typeContributors = OsgiServiceUtil.getServiceImpls( TypeContributor.class, context );
    for ( TypeContributor typeContributor : typeContributors ) {
      configuration.registerTypeContributor( typeContributor );
    }

    final ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder( builder.build() )
        .applySettings( configuration.getProperties() ).build();
    return configuration.buildSessionFactory( serviceRegistry );
  }
View Full Code Here

Examples of org.hibernate.boot.registry.BootstrapServiceRegistryBuilder

  protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
  }

  protected BootstrapServiceRegistry buildBootstrapServiceRegistry() {
    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    prepareBootstrapRegistryBuilder( builder );
    return builder.build();
  }
View Full Code Here

Examples of org.hibernate.service.BootstrapServiceRegistryBuilder

     *         classloader and system classloader
     */
    protected BootstrapServiceRegistry createHibernateBootstrapServiceRegistry() {
        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
        ClassLoader hibernateCl = BootstrapServiceRegistry.class.getClassLoader();
        return new BootstrapServiceRegistryBuilder().withApplicationClassLoader(tccl).withHibernateClassLoader(hibernateCl)
                .build();
    }
View Full Code Here

Examples of org.hibernate.service.BootstrapServiceRegistryBuilder

    configure( cfg.getProperties(), new HashMap() );
    return buildEntityManagerFactory();
  }

  public EntityManagerFactory buildEntityManagerFactory() {
    return buildEntityManagerFactory( new BootstrapServiceRegistryBuilder() );
  }
View Full Code Here

Examples of org.hibernate.service.BootstrapServiceRegistryBuilder

    prepareBasicRegistryBuilder( registryBuilder );
    return (StandardServiceRegistryImpl) registryBuilder.buildServiceRegistry();
  }

  protected BootstrapServiceRegistry generateBootstrapRegistry(Properties properties) {
    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    prepareBootstrapRegistryBuilder( builder );
    return builder.build();
  }
View Full Code Here

Examples of org.hibernate.service.BootstrapServiceRegistryBuilder

    configure( cfg.getProperties(), new HashMap() );
    return buildEntityManagerFactory();
  }

  public EntityManagerFactory buildEntityManagerFactory() {
    return buildEntityManagerFactory( new BootstrapServiceRegistryBuilder() );
  }
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.