public class GridHibernateEntityRegion extends GridHibernateTransactionalDataRegion 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 GridGain as L2 cache provider. -->
<property name="cache.region.factory_class">org.gridgain.grid.cache.hibernate.GridHibernateRegionFactory</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, grid| Constructor and Description |
|---|
GridHibernateEntityRegion(GridHibernateRegionFactory factory,
String name,
org.gridgain.grid.Grid grid,
org.gridgain.grid.cache.GridCache<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, isTransactionAwarecontains, destroy, getElementCountInMemory, getElementCountOnDisk, getName, getSizeInMemory, getTimeout, nextTimestamp, toMapclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic GridHibernateEntityRegion(GridHibernateRegionFactory factory, String name, org.gridgain.grid.Grid grid, org.gridgain.grid.cache.GridCache<Object,Object> cache, org.hibernate.cache.spi.CacheDataDescription dataDesc)
factory - Region factory.name - Region name.grid - 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.EntityRegionorg.hibernate.cache.CacheException
GridGain Fabric : ver. 6.6.9-p1 Release Date : August 10 2016