public class HibernateEntityRegion extends HibernateTransactionalDataRegion implements org.hibernate.cache.spi.EntityRegion
EntityRegion
. This region is used to store entity data.
L2 cache for entity can be enabled in the Hibernate configuration file:
<hibernate-configuration> <!-- Enable L2 cache. --> <property name="cache.use_second_level_cache">true</property> <!-- Use Ignite as L2 cache provider. --> <property name="cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</property> <!-- Specify entity. --> <mapping class="com.example.Entity"/> <!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --> <class-cache class="com.example.Entity" usage="nonstrict-read-write"/> </hibernate-configuration>Also cache for entity can be enabled using annotations:
@javax.persistence.Entity @javax.persistence.Cacheable @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Entity { ... }
cache, factory, ignite
Constructor and Description |
---|
HibernateEntityRegion(HibernateRegionFactory factory,
String name,
Ignite ignite,
org.apache.ignite.internal.processors.cache.IgniteInternalCache<Object,Object> cache,
org.hibernate.cache.spi.CacheDataDescription dataDesc) |
Modifier and Type | Method and Description |
---|---|
org.hibernate.cache.spi.access.EntityRegionAccessStrategy |
buildAccessStrategy(org.hibernate.cache.spi.access.AccessType accessType) |
createAccessStrategy, getCacheDataDescription, isTransactionAware
contains, destroy, getElementCountInMemory, getElementCountOnDisk, getName, getSizeInMemory, getTimeout, nextTimestamp, toMap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public HibernateEntityRegion(HibernateRegionFactory factory, String name, Ignite ignite, org.apache.ignite.internal.processors.cache.IgniteInternalCache<Object,Object> cache, org.hibernate.cache.spi.CacheDataDescription dataDesc)
factory
- Region factory.name
- Region name.ignite
- Grid.cache
- Region cache,dataDesc
- Region data description.public org.hibernate.cache.spi.access.EntityRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.spi.access.AccessType accessType) throws org.hibernate.cache.CacheException
buildAccessStrategy
in interface org.hibernate.cache.spi.EntityRegion
org.hibernate.cache.CacheException
Follow @ApacheIgnite
Ignite Fabric : ver. 1.2.0-incubating Release Date : June 16 2015