【问题标题】:Hibernate configuration equivalent of ehcache.xml等效于 ehcache.xml 的休眠配置
【发布时间】:2015-03-05 15:29:43
【问题描述】:

是否有任何与 `ehcache.xml 等效的 Hibernate 配置?

【问题讨论】:

标签: java hibernate caching configuration ehcache


【解决方案1】:

不,没有。 Hibernate EhCacheRegionFactory 在加载时尝试加载 ehcache.xml 配置:

String configurationResourceName = null;
if ( properties != null ) {
    configurationResourceName = (String) properties.get( NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME );
}
if ( configurationResourceName == null || configurationResourceName.length() == 0 ) {
    final Configuration configuration = ConfigurationFactory.parseConfiguration();
    manager = new CacheManager( configuration );
}
else {
    final URL url = loadResource( configurationResourceName );
    final Configuration configuration = HibernateEhcacheUtils.loadAndCorrectConfiguration( url );
    manager = new CacheManager( configuration );
}

ehcache.xml 资源可以使用net.sf.ehcache.configurationResourceName 属性进行配置:

net.sf.ehcache.configurationResourceName=/name_of_ehcache.xml

【讨论】:

    猜你喜欢
    • 2016-11-20
    • 2017-10-21
    • 2010-12-23
    • 2010-11-08
    • 2013-12-06
    • 1970-01-01
    • 2015-07-28
    • 2016-05-06
    • 2018-10-21
    相关资源
    最近更新 更多