应用中使用了二级缓存,但是没有给出属性hibernate.cache.region.factory_class
Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given
我在启动应用程序时遇到以下错误,只有在域对象上添加 @cache(usage=CacheConcurrencyStrategy.READ_WRITE)
注释时才会出现此异常。如果我只使用注释 @Cacheable(true)
它不会给出这个错误。
org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath).
仅使用 Cacheble 怎么可能找到工厂,而使用 @Cache
注释却找不到?
persistence.xml
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/>
我在 JBoss EAP 6
上使用 Hibernate 版本 4.x JPA 2.1
能否请您尝试将此添加到您的 class。缓存(用法=CacheConcurrencyStrategy.READ_ONLY,区域="employee")。
将区域名称更改为您正在使用的区域名称encache.xml
我在启动应用程序时遇到以下错误,只有在域对象上添加 @cache(usage=CacheConcurrencyStrategy.READ_WRITE)
注释时才会出现此异常。如果我只使用注释 @Cacheable(true)
它不会给出这个错误。
org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath).
仅使用 Cacheble 怎么可能找到工厂,而使用 @Cache
注释却找不到?
persistence.xml
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/>
我在 JBoss EAP 6
上使用 Hibernate 版本 4.x JPA 2.1能否请您尝试将此添加到您的 class。缓存(用法=CacheConcurrencyStrategy.READ_ONLY,区域="employee")。
将区域名称更改为您正在使用的区域名称encache.xml