hzitoun
hzitoun

Reputation: 5832

Hibernate configuration equivalent of ehcache.xml

Is there any Hibernate configuration equivalent of `ehcache.xml?

Upvotes: 1

Views: 760

Answers (1)

Vlad Mihalcea
Vlad Mihalcea

Reputation: 153780

No, there's not. Hibernate EhCacheRegionFactory tries to load the ehcache.xml configuration upon loading:

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 );
}

The ehcache.xml resource can be configured using the net.sf.ehcache.configurationResourceName property:

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

Upvotes: 1

Related Questions