Hibernate in multi module maven project - could not find specific ehcache configuration

大憨熊 提交于 2019-12-11 06:27:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!