相当于 ehcache.xml 的 Hibernate 配置

Hibernate configuration equivalent of ehcache.xml

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

不,没有。 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 );
}

可以使用 net.sf.ehcache.configurationResourceName 属性:

配置 ehcache.xml 资源
net.sf.ehcache.configurationResourceName=/name_of_ehcache.xml