could not instantiate RegionFactory
Instead of:
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.EhCache"/>
Use:
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
For example, using Hibernate 4.x along with the JAR files hibernate-ehcache-4.3.10.Final.jar and slf4j-api-1.6.1.jar, modify persistence.xml
:
<properties>
<!-- ... other properties ... -->
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
</properties>
Then ensure that hibernate-ehcache-4.3.10.Final.jar
and slf4j-api-1.6.1.jar
are deployed to JBoss.
Do not include
ehcache-core-2.4.3.jar
.
Now you can annotate entities, such as:
@Entity
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL, region = "region_name")
public class MyEntity implements Serializable {
// ...
}