Package org.hibernate.service

Examples of org.hibernate.service.ServiceRegistry


  @SuppressWarnings("unchecked")
  public EntityManagerFactory build() {
    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


    @Override
    public void sessionFactoryClosed(SessionFactory sessionFactory) {
      SessionFactoryImplementor sfi = ( (SessionFactoryImplementor) sessionFactory );
      sfi.getServiceRegistry().destroy();
      ServiceRegistry basicRegistry = sfi.getServiceRegistry().getParentServiceRegistry();
      ( (ServiceRegistryImplementor) basicRegistry ).destroy();
    }
View Full Code Here

    this.dropSQL = configuration.generateDropSchemaScript( dialect );
    this.createSQL = configuration.generateSchemaCreationScript( dialect );
  }

  public SchemaExport(MetadataImplementor metadata) {
    ServiceRegistry serviceRegistry = metadata.getServiceRegistry();
    this.connectionHelper = new SuppliedConnectionProviderConnectionHelper(
        serviceRegistry.getService( ConnectionProvider.class )
    );
        JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
    this.sqlStatementLogger = jdbcServices.getSqlStatementLogger();
    this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
    this.sqlExceptionHelper = jdbcServices.getSqlExceptionHelper();

    this.importFiles = ConfigurationHelper.getString(
        AvailableSettings.HBM2DDL_IMPORT_FILES,
        serviceRegistry.getService( ConfigurationService.class ).getSettings(),
        DEFAULT_IMPORT_FILE
    );

    final Dialect dialect = jdbcServices.getDialect();
    this.dropSQL = metadata.getDatabase().generateDropSchemaScript( dialect );
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( properties ).buildServiceRegistry();
    setSessionFactoryObserver(
        new SessionFactoryObserver() {
          @Override
          public void sessionFactoryCreated(SessionFactory factory) {
          }
View Full Code Here

    assertEquals(new TableIdentifier(null, SCHEMA, TABLE2), masterid);
  }
 
  public void testNeedQuote() {
    Settings buildSettings = cfg.buildSettings();
    ServiceRegistry serviceRegistry = cfg.getServiceRegistry();
       
    MetaDataDialect realMetaData = JDBCReaderFactory.newMetaDataDialect( serviceRegistry.getService(JdbcServices.class).getDialect(), cfg.getProperties() );
    assertTrue("The name must be quoted!", realMetaData.needQuote(SCHEMA));
    assertTrue("The name must be quoted!", realMetaData.needQuote(TABLE1));
    assertTrue("The name must be quoted!", realMetaData.needQuote(TABLE2));
  }
View Full Code Here

   * Because of this there are 2 opposite methods(and they are both failed as addTable uses quoted names
   * but getTable uses non-quoted names )
   */
  public void testQuotedNamesAndDefaultDatabaseCollector() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    ServiceRegistry serviceRegistry = builder.build();
    Settings buildSettings = cfg.buildSettings(serviceRegistry);
       
    MetaDataDialect realMetaData = JDBCReaderFactory.newMetaDataDialect( serviceRegistry.getService(JdbcServices.class).getDialect(), cfg.getProperties() );
   
    JDBCReader reader = JDBCReaderFactory.newJDBCReader( buildSettings, new DefaultReverseEngineeringStrategy(), realMetaData, serviceRegistry );
   
    DatabaseCollector dc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    reader.readDatabaseSchema( dc, null, SCHEMA );
View Full Code Here

   */
  protected void executeDDL(String[] sqls, boolean ignoreErrors) throws SQLException {   
    Configuration configuration = new Configuration();
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    builder.applySettings(configuration.getProperties());
    ServiceRegistry serviceRegistry = builder.build();
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
   
    if(!appliesTo( jdbcServices.getDialect() )) {
      fail("test case does not apply to " + jdbcServices.getDialect());
      return; // don't do anything to avoid crippled db
    }
View Full Code Here

  public void assertNoTables() throws SQLException {
    Configuration configuration = new Configuration();
   
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    builder.applySettings(configuration.getProperties());
    ServiceRegistry serviceRegistry = builder.build();
   
    Settings testSettings = configuration.buildSettings(serviceRegistry);
   
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
    Connection con = null;
        try {
   
    con = jdbcServices.getConnectionProvider().getConnection();
   
View Full Code Here

    Configuration configuration = new Configuration();
    addMappings( getMappings(), configuration );
    configuration.buildMappings();
 
    SchemaByMetaDataDetector analyzer = new SchemaByMetaDataDetector();
    ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
      .applySettings( configuration.getProperties() )
      .build();
    analyzer.initialize( configuration, configuration.buildSettings(serviceRegistry) );
   
    Iterator tableMappings = configuration.getTableMappings();
View Full Code Here

  }
 
  public void testReadSchemaIncremental() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    builder.applySettings(cfg.getProperties());
    ServiceRegistry serviceRegistry = builder.build();

    Settings buildSettings = cfg.buildSettings(serviceRegistry);

    TableSelectorStrategy tss = new TableSelectorStrategy(new DefaultReverseEngineeringStrategy());
    MockedMetaDataDialect mockedMetaDataDialect = new MockedMetaDataDialect();
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.