Package org.hibernate.service

Examples of org.hibernate.service.ServiceRegistry


      config.configure(this.getResource());
      String batchSize = config.getProperty("hibernate.jdbc.batch_size");
      Integer batchSizeNumber = Integer.valueOf(batchSize);
      this.setBatchSize(batchSizeNumber.intValue());
     
      ServiceRegistry registry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
      SessionFactory factory = config.buildSessionFactory(registry);
      setSessionFactory(factory);
    } catch (HibernateException exception) {
      StringBuffer msg = new StringBuffer();
      msg.append("Error when loading Hibernate configuration file. Message: '").append(exception.getMessage()).append("'.");
View Full Code Here


      config.configure(this.file);
      String batchSize = config.getProperty("hibernate.jdbc.batch_size");
      Integer batchSizeNumber = Integer.valueOf(batchSize);
      this.setBatchSize(batchSizeNumber.intValue());
     
      ServiceRegistry registry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
      SessionFactory factory = config.buildSessionFactory(registry);
      setSessionFactory(factory);
    } catch (HibernateException exception) {
      StringBuffer msg = new StringBuffer();
      msg.append("Error when loading Hibernate configuration file. Message: '").append(exception.getMessage()).append("'.");
View Full Code Here

        logger.debug(log.toString());
      }
      Integer batchSizeNumber = Integer.valueOf(batchSize);
      this.setBatchSize(batchSizeNumber.intValue());
     
      ServiceRegistry registry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
      SessionFactory factory = config.buildSessionFactory(registry);
      setSessionFactory(factory);
    } catch (HibernateException exception) {
      StringBuffer msg = new StringBuffer();
      msg.append("Error when loading Hibernate configuration file. Message: '").append(exception.getMessage()).append("'.");
View Full Code Here

   * @deprecated Use {@link #buildSessionFactory(ServiceRegistry)} instead
   */
  public SessionFactory buildSessionFactory() throws HibernateException {
    Environment.verifyProperties( properties );
    ConfigurationHelper.resolvePlaceHolders( properties );
    final ServiceRegistry serviceRegistry =  new BasicServiceRegistryImpl( properties );
    setSessionFactoryObserver(
        new SessionFactoryObserver() {
          @Override
          public void sessionFactoryCreated(SessionFactory factory) {
          }
View Full Code Here

    final TypeContributor[] typeContributors = osgiServiceUtil.getServiceImpls( TypeContributor.class );
    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

  private final String nodeName;

  public OgmCollectionPersister(final Collection collection, final CollectionRegionAccessStrategy cacheAccessStrategy, final Configuration cfg, final SessionFactoryImplementor factory)
      throws MappingException, CacheException {
    super( collection, cacheAccessStrategy, cfg, factory );
    ServiceRegistry registry = factory.getServiceRegistry();
    final TypeTranslator typeTranslator = registry.getService( TypeTranslator.class );
    this.gridDialect = registry.getService( GridDialect.class );

    keyGridType = typeTranslator.getType( getKeyType() );
    elementGridType = typeTranslator.getType( getElementType() );
    indexGridType = typeTranslator.getType( getIndexType() );
    identifierGridType = typeTranslator.getType( getIdentifierType() );
View Full Code Here

  private final AssociationContext associationContext;

  public OgmCollectionPersister(final Collection collection, final CollectionRegionAccessStrategy cacheAccessStrategy, final Configuration cfg, final SessionFactoryImplementor factory)
      throws MappingException, CacheException {
    super( collection, cacheAccessStrategy, cfg, factory );
    ServiceRegistry registry = factory.getServiceRegistry();
    final TypeTranslator typeTranslator = registry.getService(TypeTranslator.class);
    this.gridDialect = registry.getService(DatastoreServices.class).getGridDialect();
    keyGridType = typeTranslator.getType( getKeyType() );
    elementGridType = typeTranslator.getType( getElementType() );
    indexGridType = typeTranslator.getType( getIndexType() );
    identifierGridType = typeTranslator.getType( getIdentifierType() );
    //copied from the superclass constructor
View Full Code Here

   * @deprecated Use {@link #buildSessionFactory(ServiceRegistry)} instead
   */
  public SessionFactory buildSessionFactory() throws HibernateException {
    Environment.verifyProperties( properties );
    ConfigurationHelper.resolvePlaceHolders( properties );
    final ServiceRegistry serviceRegistry =  new ServiceRegistryBuilder()
        .applySettings( properties )
        .buildServiceRegistry();
    setSessionFactoryObserver(
        new SessionFactoryObserver() {
          @Override
View Full Code Here

    final TypeContributor[] typeContributors = osgiServiceUtil.getServiceImpls( TypeContributor.class );
    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

  @Override
  public void generateSchema() {
    processProperties();

    final ServiceRegistry serviceRegistry = buildServiceRegistry();
    final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );

    // IMPL NOTE : TCCL handling here is temporary.
    //    It is needed because this code still uses Hibernate Configuration and Hibernate commons-annotations
    //     in turn which relies on TCCL being set.
View Full Code Here

TOP

Related Classes of org.hibernate.service.ServiceRegistry

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.