-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: provider_configuration_file_resource_path is ignored
PostPosted: Tue Feb 03, 2009 2:44 pm 
Newbie

Joined: Tue Feb 03, 2009 2:30 pm
Posts: 3
I'm using Hibernate 3.3.1 GA and Ehcache 1.5 and have noticed that the property that enables you to specify an ehcache configuration is ignored.

Code:
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</property>               
<property name="hibernate.cache.provider_configuration_file_resource_path">ehcache.xml</property>   


If I specifiy another name for the file in the config above (say ehcache-2.xml), the ehcache config is still read from ehcache.xml.

Furthermore, if I rename my actual file ehcache.xml to something else (say ehcache-2.xml) and then set the configuration_file_resource_path to match the hibernate logs tell me that no configuration was found and it instead uses the ehcache failsafe settings.

Code:
2009-02-03 18:38:17,327 INFO [main] org.hibernate.impl.SessionFactoryImpl - building session factory - 2623
2009-02-03 18:38:17,347 WARN [main] net.sf.ehcache.config.ConfigurationFactory - No configuration found. Configuring ehcache from ehcache-failsafe.xml  found in the classpath: jar:file:/C:/Documents%20and%20Settings/Administrator/.m2/repository/net/sf/ehcache/ehcache/1.5.0/ehcache-1.5.0.jar!/ehcache-failsafe.xml - 2643
2009-02-03 18:38:17,417 WARN [main] net.sf.ehcache.hibernate.SingletonEhCacheProvider - Could not find a specific ehcache configuration for cache named [uk.co.mycompany.data.entities.Company]; using defaults. - 2713


This occurs with the net.sf.ehcache.hibernate.SingletonEhCacheProvider or with the org.hibernate.cache.EhCacheProvider class supplied in the hibernate-ehcache module.

It looks like the property hibernate.cache.provider_configuration_file_resource_path is ignored and ehcache tries to load its configuration from a file called ehcache.xml no matter what.

Has this property been renamed in hibernate 3.3? All the documentation and comments in the API docs for the org.hibernate.cache.EhCacheProvider classes state that this provider_configuration_file_resource_path property is the one to use to set an alternative ehcache configuration.

Many thanks in advance for any suggestions.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2009 1:37 pm 
Newbie

Joined: Tue Feb 03, 2009 2:30 pm
Posts: 3
I think I have managed to resolve this myself.

I had a look in the http://anonsvn.jboss.org repository and examined the way that cache providers are set up.

It looks like this underwent a change from Hibernate 3.2 to 3.3 where Echache has become less of a default implementation of caching for Hibernate.

As a result of this, it seems that the property that needs to be used in hibernate.cfg.xml is net.sf.ehcache.configurationResourceName as demonstrated below:

Code:
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</property>           
<property name="net.sf.ehcache.configurationResourceName">/hibernate-ehcache.xml</property>


That is probably why the hibernate.cache.provider_configuration_file_resource_path is now redundant. It looks like the documentation both in the API docs and in SVN haven't quite caught up with this change in how the specific cache provider implementations are set up in Hibernate.

As a result of using the net.sf.ehcache.configurationResourceName property I can now specify an ehcache config with a name other than /ehcache.xml, so my problem is solved.

However, I'd appreciate some confirmation as to whether my statements above are correct.

It also looks like a SingletonEhCacheProvider has made its way into the main trunk for the hibernate-ehcache module in SVN (http://anonsvn.jboss.org/repos/hibernat ... vider.java).

Presumably, when this is released I should use that version instead of the net.sf.ehcache.hibernate.SingletonEhCacheProvider.

Any clarification on the best way to understand the hibernate-ehcache integration in 3.3x will be much appreciated!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.