问题
I am having trouble getting hibernate 2nd level cache to work properly in my project.
I have the following maven structure:
myProject
-core
-ui
-pom
In my core module I have a session factory configured using hibernate properties. The ones of concern are:
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="net.sf.ehcache.configurationResourceName">/ehcacheAdmin.xml</prop>
I have unit tests that verify the cache is working correctly.
I add the core module as a jar file to the ui module. When I do this and start my tomcat server I get the following warning:
WARN org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory - HH020003: Could not find a specific ehcache configuration for cache named [org.hibernate.cache.spi.UpdateTimestampsCache]; using defaults
Can someone help me with this? I would like the jar file to be solely responsible for querying the database and caching.
Thanks
回答1:
Try to add UpdateTimestampsCache to ehcache.xml file.
Search how to configure UpdateTimestampsCache here.
来源:https://stackoverflow.com/questions/19280073/hibernate-in-multi-module-maven-project-could-not-find-specific-ehcache-config