• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConfigurationService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.hibernate.engine.config.spi.ConfigurationService的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationService类的具体用法?Java ConfigurationService怎么用?Java ConfigurationService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConfigurationService类属于org.hibernate.engine.config.spi包,在下文中一共展示了ConfigurationService类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: SchemaExport

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
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 );
	this.createSQL = metadata.getDatabase().generateSchemaCreationScript( dialect );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:SchemaExport.java


示例2: createEntityCopyObserver

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
private EntityCopyObserver createEntityCopyObserver(SessionFactoryImplementor sessionFactory) {
	final ServiceRegistry serviceRegistry = sessionFactory.getServiceRegistry();
	if ( entityCopyObserverStrategy == null ) {
		final ConfigurationService configurationService
				= serviceRegistry.getService( ConfigurationService.class );
		entityCopyObserverStrategy = configurationService.getSetting(
				"hibernate.event.merge.entity_copy_observer",
				new ConfigurationService.Converter<String>() {
					@Override
					public String convert(Object value) {
						return value.toString();
					}
				},
				EntityCopyNotAllowedObserver.SHORT_NAME
		);
		LOG.debugf( "EntityCopyObserver strategy: %s", entityCopyObserverStrategy );
	}
	final StrategySelector strategySelector = serviceRegistry.getService( StrategySelector.class );
	return strategySelector.resolveStrategy( EntityCopyObserver.class, entityCopyObserverStrategy );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:DefaultMergeEventListener.java


示例3: testCreationOfSessionFactory

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Test
public void testCreationOfSessionFactory() {
    Properties props = getProperties();
    Config conf = ConfigFactory.parseProperties(props);

    hs = new HibernateService(conf);
    SessionFactory sf = hs.getSessionFactory();
    assertNotNull(sf);
    assertFalse(sf.isClosed());

    // traverse through the session factory to get at configuration values
    SessionFactoryOptions sfo = sf.getSessionFactoryOptions();
    StandardServiceRegistry ssr = sfo.getServiceRegistry();
    ConfigurationService cs = ssr.getService(ConfigurationService.class);
    assertEquals(props.getProperty("hibernate.connection.driver_class"), cs.getSetting("hibernate.connection.driver_class", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.connection.url"), cs.getSetting("hibernate.connection.url", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.dialect"), cs.getSetting("hibernate.dialect", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.hbm2ddl.auto"), cs.getSetting("hibernate.hbm2ddl.auto", StandardConverters.STRING));

    // check mapping
    ClassMetadata cm = sf.getClassMetadata(TestObject.class);
    String[] names = cm.getPropertyNames();
    assertEquals(1, names.length);
    assertEquals("name", names[0]);
    assertEquals("string", cm.getPropertyType("name").getName());
}
 
开发者ID:DorsetProject,项目名称:dorset-framework,代码行数:27,代码来源:HibernateServiceTest.java


示例4: getAlterTableToAddUniqueKeyCommand

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public String getAlterTableToAddUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata)
{
	ConfigurationService config = metadata.getDatabase().getBuildingOptions().getServiceRegistry()
			.getService(ConfigurationService.class);
	if (config != null)
	{
		String value = config.getSetting("hibernate.hbm2ddl.auto", StandardConverters.STRING);
		if (!value.equalsIgnoreCase("update"))
		{
			// We should only check whether it is already present in an
			// update scenario, in all other scenarios, just return the
			// actual create statement.
			return org.hibernate.mapping.Index.buildSqlCreateIndexString(dialect, uniqueKey.getName(),
					uniqueKey.getTable(), uniqueKey.columnIterator(), uniqueKey.getColumnOrderMap(), true,
					metadata);
		}
	}
	// First check that this unique key is not already present, as this is a
	// lot faster than trying to create it and then fail.
	initIndices();
	UniqueIndex idx = indices.getIndex(uniqueKey);
	if (idx != null)
	{
		return null;
	}
	return org.hibernate.mapping.Index.buildSqlCreateIndexString(dialect, uniqueKey.getName(), uniqueKey.getTable(),
			uniqueKey.columnIterator(), uniqueKey.getColumnOrderMap(), true, metadata);
}
 
开发者ID:olavloite,项目名称:spanner-hibernate,代码行数:30,代码来源:CloudSpannerUniqueDelegate.java


示例5: resolve

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@SuppressWarnings( {"unchecked"} )
void resolve() {
	for ( EntityBinding entityBinding : metadata.getEntityBindings() ) {
		if ( entityBinding.isRoot() ) {
			Properties properties = new Properties( );
			properties.putAll(
					metadata.getServiceRegistry()
							.getService( ConfigurationService.class )
							.getSettings()
			);
			//TODO: where should these be added???
			if ( ! properties.contains( AvailableSettings.PREFER_POOLED_VALUES_LO ) ) {
				properties.put( AvailableSettings.PREFER_POOLED_VALUES_LO, "false" );
			}
			if ( ! properties.contains( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER ) ) {
				properties.put(
						PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
						new ObjectNameNormalizerImpl( metadata )
				);
			}
			entityBinding.getHierarchyDetails().getEntityIdentifier().createIdentifierGenerator(
					metadata.getIdentifierGeneratorFactory(),
					properties
			);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:IdentifierGeneratorResolver.java


示例6: initiateService

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public StatisticsImplementor initiateService(
		SessionFactoryImplementor sessionFactory,
		MetadataImplementor metadata,
		ServiceRegistryImplementor registry) {
	ConfigurationService configurationService =  registry.getService( ConfigurationService.class );
	final Object configValue = configurationService.getSetting( STATS_BUILDER, null );
	return initiateServiceInternal( sessionFactory, configValue, registry );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:StatisticsInitiator.java


示例7: determineCurrentTenantIdentifierResolver

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
private CurrentTenantIdentifierResolver determineCurrentTenantIdentifierResolver(
		CurrentTenantIdentifierResolver explicitResolver) {
	if ( explicitResolver != null ) {
		return explicitResolver;
	}
	return serviceRegistry.getService( ConfigurationService.class )
			.getSetting(
					AvailableSettings.MULTI_TENANT_IDENTIFIER_RESOLVER,
					CurrentTenantIdentifierResolver.class,
					null
			);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:SessionFactoryImpl.java


示例8: injectServices

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public void injectServices(ServiceRegistryImplementor serviceRegistry) {
    Map settings = serviceRegistry.getService(ConfigurationService.class).getSettings();
    DataSource dataSource = (DataSource) settings.get(Environment.DATASOURCE);
    datasourceConnectionProvider.setDataSource(dataSource);
    datasourceConnectionProvider.configure(settings);
    logger.debug("connection provider:{}", datasourceConnectionProvider);
}
 
开发者ID:ligson,项目名称:cutdb,代码行数:9,代码来源:SchemaBasedMultiTenantConnectionProvider.java


示例9: prepare

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public void prepare(JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess, MetadataImplementor metadata, SessionFactoryOptions sessionFactoryOptions) {
    ConfigurationService configService = sessionFactoryOptions.getServiceRegistry().getService(ConfigurationService.class);
    this.fullyQualifiedTableName = Objects.requireNonNull(configService.getSetting(TABLE, String.class, null), "Property " + TABLE + " must be set.");
    this.idColumn = configService.getSetting(ID_COLUMN, String.class, "ID");
    this.discriminatorColumn = configService.getSetting(DISCRIMINATOR_COLUMN, String.class, "ENTITY_NAME");
    this.cleanRows = configService.getSetting(CLEAN_ROWS, StandardConverters.BOOLEAN, false);
}
 
开发者ID:grimsa,项目名称:hibernate-single-table-bulk-id-strategy,代码行数:9,代码来源:SingleGlobalTemporaryTableBulkIdStrategy.java


示例10: injectServices

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public void injectServices(ServiceRegistryImplementor serviceRegistry) {
	final Object dataSourceConfigValue = serviceRegistry.getService( ConfigurationService.class )
			.getSettings()
			.get( AvailableSettings.DATASOURCE );
	if ( dataSourceConfigValue == null || ! String.class.isInstance( dataSourceConfigValue ) ) {
		throw new HibernateException( "Improper set up of DataSourceBasedMultiTenantConnectionProviderImpl" );
	}
	final String jndiName = (String) dataSourceConfigValue;

	jndiService = serviceRegistry.getService( JndiService.class );
	if ( jndiService == null ) {
		throw new HibernateException( "Could not locate JndiService from DataSourceBasedMultiTenantConnectionProviderImpl" );
	}

	final Object namedObject = jndiService.locate( jndiName );
	if ( namedObject == null ) {
		throw new HibernateException( "JNDI name [" + jndiName + "] could not be resolved" );
	}

	if ( DataSource.class.isInstance( namedObject ) ) {
		final int loc = jndiName.lastIndexOf( "/" );
		this.baseJndiNamespace = jndiName.substring( 0, loc );
		this.tenantIdentifierForAny = jndiName.substring( loc + 1 );
		dataSourceMap().put( tenantIdentifierForAny, (DataSource) namedObject );
	}
	else if ( Context.class.isInstance( namedObject ) ) {
		this.baseJndiNamespace = jndiName;
		this.tenantIdentifierForAny = (String) serviceRegistry.getService( ConfigurationService.class )
				.getSettings()
				.get( TENANT_IDENTIFIER_TO_USE_FOR_ANY_KEY );
		if ( tenantIdentifierForAny == null ) {
			throw new HibernateException( "JNDI name named a Context, but tenant identifier to use for ANY was not specified" );
		}
	}
	else {
		throw new HibernateException(
				"Unknown object type [" + namedObject.getClass().getName() +
						"] found in JNDI location [" + jndiName + "]"
		);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:DataSourceBasedMultiTenantConnectionProviderImpl.java


示例11: initiateService

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public ConfigurationService initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
	return new ConfigurationServiceImpl( configurationValues );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ConfigurationServiceInitiator.java


示例12: getServiceInitiated

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public Class<ConfigurationService> getServiceInitiated() {
	return ConfigurationService.class;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ConfigurationServiceInitiator.java


示例13: injectServices

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public void injectServices(ServiceRegistryImplementor serviceRegistry) {
    Map lSettings = serviceRegistry.getService(ConfigurationService.class).getSettings();
    lazyDatasource = (DataSource) lSettings.get(Environment.DATASOURCE);
}
 
开发者ID:thpham,项目名称:ithings-demo,代码行数:6,代码来源:MultiTenantConnectionProviderImpl.java


示例14: configure

import org.hibernate.engine.config.spi.ConfigurationService; //导入依赖的package包/类
@Override
public void configure(
        Type type, Properties params, ServiceRegistry serviceRegistry)
        throws MappingException {
    final JdbcEnvironment jdbcEnvironment =
            serviceRegistry.getService(JdbcEnvironment.class);
    final Dialect dialect = jdbcEnvironment.getDialect();

    final ConfigurationService configurationService =
            serviceRegistry.getService(ConfigurationService.class);
    String globalEntityIdentifierPrefix =
        configurationService.getSetting( "entity.identifier.prefix", String.class, "SEQ_" );

    sequencePrefix = ConfigurationHelper.getString(
            SEQUENCE_PREFIX,
            params,
            globalEntityIdentifierPrefix);

    final String sequencePerEntitySuffix = ConfigurationHelper.getString(
            SequenceStyleGenerator.CONFIG_SEQUENCE_PER_ENTITY_SUFFIX,
            params,
            SequenceStyleGenerator.DEF_SEQUENCE_SUFFIX);

    final String defaultSequenceName = ConfigurationHelper.getBoolean(
            SequenceStyleGenerator.CONFIG_PREFER_SEQUENCE_PER_ENTITY,
            params,
            false)
            ? params.getProperty(JPA_ENTITY_NAME) + sequencePerEntitySuffix
            : SequenceStyleGenerator.DEF_SEQUENCE_NAME;

    sequenceCallSyntax = dialect.getSequenceNextValString(
            ConfigurationHelper.getString(
                    SequenceStyleGenerator.SEQUENCE_PARAM,
                    params,
                    defaultSequenceName));
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:37,代码来源:StringSequenceIdentifier.java



注:本文中的org.hibernate.engine.config.spi.ConfigurationService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ImageLoader类代码示例发布时间:2022-05-22
下一篇:
Java ASTVisitor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap