类org.hibernate.cfg.Settings源码实例Demo

下面列出了怎么用org.hibernate.cfg.Settings的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: cacheonix-core   文件: StandardQueryCache.java
public StandardQueryCache(
		final Settings settings, 
		final Properties props, 
		final UpdateTimestampsCache updateTimestampsCache, 
		String regionName) throws HibernateException {
	if ( regionName == null ) {
		regionName = StandardQueryCache.class.getName();
	}
	String prefix = settings.getCacheRegionPrefix();
	if ( prefix != null ) {
		regionName = prefix + '.' + regionName;
	}
	log.info( "starting query cache at region: " + regionName );

	this.queryCache = settings.getCacheProvider().buildCache(regionName, props);
	this.updateTimestampsCache = updateTimestampsCache;
	this.regionName = regionName;
}
 
HibernateCacheTimestamper populateTimestamper(Settings settings, OverridableReadOnlyProperties properties) {
    String timestamperClazzName = properties.getProperty(TIMESTAMPER_PROPERTY_KEY,
            DEFAULT_TIMESTAMPER_CLASS.getName());

    HibernateCacheTimestamper timestamper;
    try {
        Class<?> clazz = Class.forName(timestamperClazzName);
        timestamper = (HibernateCacheTimestamper) clazz.newInstance();
    } catch (Exception e) {
        throw new IllegalStateException(e.getMessage(), e);
    }

    timestamper.setSettings(settings);
    timestamper.setProperties(properties);
    timestamper.setMemcachedAdapter(memcachedAdapter);
    timestamper.init();
    return timestamper;
}
 
源代码3 项目: J2Cache   文件: J2CacheRegionFactory.java
@Override
public void start(Settings settings, Properties properties) throws CacheException {
    this.settings = settings;
    if (this.channel == null) {
        this.channel = J2Cache.getChannel();
    }
}
 
源代码4 项目: redisson   文件: RedissonRegionFactory.java
@Override
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException {
    this.redisson = createRedissonClient(properties);
    this.settings = new Settings(settings);

    StrategySelector selector = settings.getServiceRegistry().getService(StrategySelector.class);
    cacheKeysFactory = selector.resolveDefaultableStrategy(CacheKeysFactory.class,
                            properties.get(Environment.CACHE_KEYS_FACTORY), new RedissonCacheKeysFactory(redisson.getConfig().getCodec()));

}
 
@Test
public void isMinimalPutsEnabled_false() throws Exception {
    Settings settings = new TestingSettingsBuilder().setField("minimalPutsEnabled", false).build();
    when(generalDataMemcachedRegion.getSettings()).thenReturn(settings);

    assertThat(memcachedRegionAccessStrategy.isMinimalPutsEnabled()).isFalse();
}
 
源代码6 项目: hibernate4-memcached   文件: MemcachedRegion.java
public MemcachedRegion(CacheNamespace cacheNamespace, OverridableReadOnlyProperties properties, CacheDataDescription metadata, Settings settings,
                       MemcachedAdapter memcachedAdapter, HibernateCacheTimestamper hibernateCacheTimestamper) {
    this.cacheNamespace = cacheNamespace;
    this.properties = properties;
    this.metadata = metadata;
    this.settings = settings;
    this.memcachedAdapter = memcachedAdapter;
    this.hibernateCacheTimestamper = hibernateCacheTimestamper;
}
 
源代码7 项目: lams   文件: LocalSessionFactoryBuilder.java
@Override
public Settings buildSettings(Properties props, ServiceRegistry serviceRegistry) throws HibernateException {
	Settings settings = super.buildSettings(props, serviceRegistry);
	if (this.cacheRegionFactory != null) {
		try {
			Method setRegionFactory = Settings.class.getDeclaredMethod("setRegionFactory", RegionFactory.class);
			setRegionFactory.setAccessible(true);
			setRegionFactory.invoke(settings, this.cacheRegionFactory);
		}
		catch (Exception ex) {
			throw new IllegalStateException("Failed to invoke Hibernate's setRegionFactory method", ex);
		}
	}
	return settings;
}
 
@Override
public void start(Settings settings, Properties properties) throws CacheException {
    log.debug("# start Hibernate4MemcachedRegionFactory.");

    this.settings = settings;
    cacheProviderConfigProperties = populateCacheProviderConfigProperties(properties);
    OverridableReadOnlyProperties mergedConfigProperties = new OverridableReadOnlyPropertiesImpl(properties,
            cacheProviderConfigProperties);
    memcachedAdapter = populateMemcachedProvider(mergedConfigProperties);
    hibernateCacheTimestamper = populateTimestamper(settings, mergedConfigProperties);
}
 
@Override
public Settings buildSettings(Properties props, ServiceRegistry serviceRegistry) throws HibernateException {
	Settings settings = super.buildSettings(props, serviceRegistry);
	if (this.cacheRegionFactory != null) {
		try {
			Method setRegionFactory = Settings.class.getDeclaredMethod("setRegionFactory", RegionFactory.class);
			setRegionFactory.setAccessible(true);
			setRegionFactory.invoke(settings, this.cacheRegionFactory);
		}
		catch (Exception ex) {
			throw new IllegalStateException("Failed to invoke Hibernate's setRegionFactory method", ex);
		}
	}
	return settings;
}
 
源代码10 项目: cacheonix-core   文件: SchemaExport.java
/**
 * Create a schema exporter for the given Configuration
 * and given settings
 */
public SchemaExport(Configuration cfg, Settings settings) throws HibernateException {
	dialect = settings.getDialect();
	connectionHelper = new SuppliedConnectionProviderConnectionHelper(
			settings.getConnectionProvider()
	);
	dropSQL = cfg.generateDropSchemaScript( dialect );
	createSQL = cfg.generateSchemaCreationScript( dialect );
	format = settings.isFormatSqlEnabled();
}
 
源代码11 项目: cacheonix-core   文件: SchemaValidator.java
public SchemaValidator(Configuration cfg, Settings settings) throws HibernateException {
	this.configuration = cfg;
	dialect = settings.getDialect();
	connectionHelper = new SuppliedConnectionProviderConnectionHelper(
			settings.getConnectionProvider()
	);
}
 
@Test
public void putFromLoad_without_minimalPutOverride() throws Exception {
    Settings settings = new TestingSettingsBuilder().setField("minimalPutsEnabled", true).build();
    when(generalDataMemcachedRegion.getSettings()).thenReturn(settings);

    memcachedRegionAccessStrategy.putFromLoad("books#1", "book 1", 1L, "version object");

    verify(memcachedRegionAccessStrategy).putFromLoad("books#1", "book 1", 1L, "version object", true);
}
 
源代码13 项目: ignite   文件: HibernateRegionFactory.java
/** {@inheritDoc} */
@Override public void start(Settings settings, Properties props) throws CacheException {
    String accessType = props.getProperty(DFLT_ACCESS_TYPE_PROPERTY, NONSTRICT_READ_WRITE.name());

    dfltAccessType = AccessType.valueOf(accessType);

    accessStgyFactory.start(props);
}
 
源代码14 项目: sakai   文件: IgniteStandardQueryCacheFactory.java
@Override
public QueryCache getQueryCache(
        final String regionName,
        final UpdateTimestampsCache updateTimestampsCache,
        final Settings settings,
        final Properties props) throws HibernateException {
    return new IgniteStandardQueryCache(settings, props, updateTimestampsCache, regionName);
}
 
public NaturalIdMemcachedRegion(String regionName, OverridableReadOnlyProperties properties,
                                CacheDataDescription metadata, Settings settings,
                                MemcachedAdapter memcachedAdapter,
                                HibernateCacheTimestamper hibernateCacheTimestamper) {
    super(new CacheNamespace(regionName, true), properties, metadata, settings, memcachedAdapter,
          hibernateCacheTimestamper);
}
 
源代码16 项目: sakai   文件: IgniteStandardQueryCacheFactory.java
@Override
public QueryCache getQueryCache(
        final String regionName,
        final UpdateTimestampsCache updateTimestampsCache,
        final Settings settings,
        final Properties props) throws HibernateException {
    return new IgniteStandardQueryCache(settings, props, updateTimestampsCache, regionName);
}
 
源代码17 项目: J2Cache   文件: J2CacheCollectionRegion.java
public J2CacheCollectionRegion(J2CacheAccessStrategyFactory accessStrategyFactory, CacheRegion underlyingCache, Settings settings, CacheDataDescription metadata, Properties properties) {
    super(accessStrategyFactory, underlyingCache, settings, metadata, properties);
}
 
public ReadWriteNaturalIdRegionAccessStrategy(Settings settings, GeneralDataRegion region,
        RMapCache<Object, Object> mapCache) {
    super(settings, region, mapCache);
}
 
源代码19 项目: J2Cache   文件: J2CacheTransactionalDataRegion.java
public Settings getSettings() {
    return settings;
}
 
源代码20 项目: J2Cache   文件: J2CacheNaturalIdRegion.java
public J2CacheNaturalIdRegion(J2CacheAccessStrategyFactory accessStrategyFactory, CacheRegion underlyingCache, Settings settings, CacheDataDescription metadata, Properties properties) {
    super(accessStrategyFactory, underlyingCache, settings, metadata, properties);
}
 
源代码21 项目: J2Cache   文件: J2CacheEntityRegion.java
public J2CacheEntityRegion(J2CacheAccessStrategyFactory accessStrategyFactory, CacheRegion underlyingCache, Settings settings, CacheDataDescription metadata, Properties properties) {
    super(accessStrategyFactory,underlyingCache, settings, metadata, properties);
}
 
源代码22 项目: J2Cache   文件: AbstractJ2CacheAccessStrategy.java
AbstractJ2CacheAccessStrategy(T region, Settings settings) {
    this.region = region;
    this.settings = settings;
}
 
源代码23 项目: J2Cache   文件: AbstractJ2CacheAccessStrategy.java
protected Settings settings() {
    return settings;
}
 
public ReadOnlyJ2CacheEntityRegionAccessStrategy(J2CacheEntityRegion region, Settings settings) {
    super(region, settings);
}
 
public ReadWriteJ2CacheCollectionRegionAccessStrategy(J2CacheCollectionRegion region, Settings settings) {
    super(region, settings);
}
 
public ReadOnlyJ2CacheNaturalIdRegionAccessStrategy(J2CacheNaturalIdRegion region, Settings settings) {
    super(region, settings);
}
 
源代码27 项目: hibernate4-memcached   文件: NaturalIdRegionImpl.java
public Settings getSettings() {
	return settings;
}
 
public NonStrictReadWriteJ2CacheEntityRegionAccessStrategy(J2CacheEntityRegion region, Settings settings) {
    super(region, settings);
}
 
public TransactionalEntityRegionAccessStrategy(Settings settings, GeneralDataRegion region) {
    super(settings, region);
}
 
public AbstractReadWriteJ2CacheAccessStrategy(T region, Settings settings) {
    super(region, settings);
    this.versionComparator = region.getCacheDataDescription().getVersionComparator();
}
 
 类所在包
 同包方法