im_ttribute
im_ttribute
2015-09-24 13:43

hibernate cache配置问题

  • spring
  • hibernat

求各位大神帮忙..
WARN: HHH020003: Could not find a specific ehcache configuration for cache named [org.hibernate.cache.internal.StandardQueryCache]; using defaults.

 <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.use_query_cache">true</prop>
                <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
                <prop key="net.sf.ehcache.configurationResourceName">/cache/mycache.xml</prop>
            </props>
        </property>

mycache.xml

 <?xml version="1.0" encoding="UTF-8"?> 
<ehcache> 
    <diskStore path="f:\\cacheFile" />
    <defaultCache maxEntriesLocalHeap="10000" eternal="false"
        timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="false"
        maxEntriesLocalDisk="100000" memoryStoreEvictionPolicy="LFU" />
</ehcache>

POJO

 @Entity
@Table(name = "Customer")
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class Customer implements Serializable {
    .....
}

代码结构

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换