@Override public void sessionFactoryClosed(SessionFactory factory) { ( (StandardServiceRegistryImpl) serviceRegistry ).destroy(); } }
@SuppressWarnings( {"unchecked"}) public StandardServiceRegistryImpl( BootstrapServiceRegistry bootstrapServiceRegistry, List<BasicServiceInitiator> serviceInitiators, List<ProvidedService> providedServices, Map<?, ?> configurationValues) { super( bootstrapServiceRegistry ); this.configurationValues = configurationValues; // process initiators for ( ServiceInitiator initiator : serviceInitiators ) { createServiceBinding( initiator ); } // then, explicitly provided service instances for ( ProvidedService providedService : providedServices ) { createServiceBinding( providedService ); } }
.setOutputFile( outFile ) .setDelimiter( delim ) .setImportSqlCommandExtractor( serviceRegistry.getService( ImportSqlCommandExtractor.class ) ); if ( format ) { se.setFormat( true ); serviceRegistry.destroy();
public void prepare(boolean needsAutoCommit) throws SQLException { serviceRegistry = createServiceRegistry( cfgProperties ); connection = serviceRegistry.getService( ConnectionProvider.class ).getConnection(); if ( needsAutoCommit && ! connection.getAutoCommit() ) { connection.commit(); connection.setAutoCommit( true ); } }
/** * Build the service registry accounting for all settings and service initiators and services. * * @return The built service registry */ public ServiceRegistry buildServiceRegistry() { Map<?,?> settingsCopy = new HashMap(); settingsCopy.putAll( settings ); Environment.verifyProperties( settingsCopy ); ConfigurationHelper.resolvePlaceHolders( settingsCopy ); for ( Integrator integrator : bootstrapServiceRegistry.getService( IntegratorService.class ).getIntegrators() ) { if ( ServiceContributingIntegrator.class.isInstance( integrator ) ) { ServiceContributingIntegrator.class.cast( integrator ).prepareServices( this ); } } return new StandardServiceRegistryImpl( bootstrapServiceRegistry, initiators, providedServices, settingsCopy ); }
@Override public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { ((StandardServiceRegistryImpl) serviceRegistry).configureService(new ServiceBinding<>((ServiceBinding.ServiceLifecycleOwner) serviceRegistry, Hibernate4Integrator.class, this)); Object o = configuration.get("hibernate.hql.bulk_id_strategy"); if (o == null) { serviceRegistry.getService(JdbcServices.class).getDialect().getDefaultProperties().put("hibernate.hql.bulk_id_strategy", new CustomMultiTableBulkIdStrategy(serviceRegistry.getService(JdbcServices.class).getDialect().supportsTemporaryTables() ? TemporaryTableBulkIdStrategy.INSTANCE : new PersistentTableBulkIdStrategy())); } else { LOG.warning("Can't replace hibernate.hql.bulk_id_strategy because it was overridden by the user with: " + o); } }
.setOutputFile( outFile ) .setDelimiter( delim ) .setImportSqlCommandExtractor( serviceRegistry.getService( ImportSqlCommandExtractor.class ) ); if ( format ) { se.setFormat( true ); serviceRegistry.destroy();
public void prepare(boolean needsAutoCommit) throws SQLException { serviceRegistry = createServiceRegistry( cfgProperties ); connection = serviceRegistry.getService( ConnectionProvider.class ).getConnection(); if ( needsAutoCommit && ! connection.getAutoCommit() ) { connection.commit(); connection.setAutoCommit( true ); } }
/** * Build the service registry accounting for all settings and service initiators and services. * * @return The built service registry */ public ServiceRegistry buildServiceRegistry() { Map<?,?> settingsCopy = new HashMap(); settingsCopy.putAll( settings ); Environment.verifyProperties( settingsCopy ); ConfigurationHelper.resolvePlaceHolders( settingsCopy ); for ( Integrator integrator : bootstrapServiceRegistry.getService( IntegratorService.class ).getIntegrators() ) { if ( ServiceContributingIntegrator.class.isInstance( integrator ) ) { ServiceContributingIntegrator.class.cast( integrator ).prepareServices( this ); } } return new StandardServiceRegistryImpl( bootstrapServiceRegistry, initiators, providedServices, settingsCopy ); }
private void releaseServiceRegistry() { if ( serviceRegistry != null ) { try { serviceRegistry.destroy(); } finally { serviceRegistry = null; } } } }
@Override public void prepare(boolean needsAutoCommit) throws SQLException { serviceRegistry = createServiceRegistry(cfgProperties); connection = serviceRegistry.getService(ConnectionProvider.class).getConnection(); if (needsAutoCommit && !connection.getAutoCommit()) { connection.commit(); connection.setAutoCommit(true); } }
@SuppressWarnings( {"unchecked"}) public StandardServiceRegistryImpl( BootstrapServiceRegistry bootstrapServiceRegistry, List<BasicServiceInitiator> serviceInitiators, List<ProvidedService> providedServices, Map<?, ?> configurationValues) { super( bootstrapServiceRegistry ); this.configurationValues = configurationValues; // process initiators for ( ServiceInitiator initiator : serviceInitiators ) { createServiceBinding( initiator ); } // then, explicitly provided service instances for ( ProvidedService providedService : providedServices ) { createServiceBinding( providedService ); } }
private void releaseServiceRegistry() { if (serviceRegistry != null) { try { serviceRegistry.destroy(); } finally { serviceRegistry = null; } } } }
private void releaseConnection() throws SQLException { if (connection != null) { try { new SqlExceptionHelper().logAndClearWarnings(connection); } finally { try { serviceRegistry.getService(ConnectionProvider.class).closeConnection(connection); } finally { connection = null; } } } }
/** * Destroy a service registry. Applications should only destroy registries they have explicitly created. * * @param serviceRegistry The registry to be closed. */ public static void destroy(ServiceRegistry serviceRegistry) { ( (StandardServiceRegistryImpl) serviceRegistry ).destroy(); } }
private void releaseConnection() throws SQLException { if ( connection != null ) { try { new SqlExceptionHelper().logAndClearWarnings( connection ); } finally { try { serviceRegistry.getService( ConnectionProvider.class ).closeConnection( connection ); } finally { connection = null; } } } }
@Override public void sessionFactoryClosed(SessionFactory factory) { ( (StandardServiceRegistryImpl) serviceRegistry ).destroy(); } }
private void releaseConnection() throws SQLException { if ( connection != null ) { try { new SqlExceptionHelper().logAndClearWarnings( connection ); } finally { try { serviceRegistry.getService( ConnectionProvider.class ).closeConnection( connection ); } finally { connection = null; } } } }
/** * Destroy a service registry. Applications should only destroy registries they have explicitly created. * * @param serviceRegistry The registry to be closed. */ public static void destroy(ServiceRegistry serviceRegistry) { ( (StandardServiceRegistryImpl) serviceRegistry ).destroy(); } }
@Override public void sessionFactoryClosed(SessionFactory factory) { ( ( StandardServiceRegistryImpl ) serviceRegistry ).destroy(); } };