public class HibernateRegionFactory extends Object implements org.hibernate.cache.spi.RegionFactory
Following Hibernate settings should be specified to enable second level cache and to use this region factory for caching:
hibernate.cache.use_second_level_cache=true hibernate.cache.region.factory_class=org.apache.ignite.cache.hibernate.HibernateRegionFactoryNote that before region factory is started you need to start properly configured Ignite node in the same JVM. For example to start Ignite node one of loader provided in
org.apache.ignite.grid.startup package can be used.
Name of grid to be used for region factory must be specified as following Hibernate property:
org.apache.ignite.hibernate.grid_name=<grid name>Each Hibernate cache region must be associated with some
IgniteInternalCache, by default it is assumed that
for each cache region there is a IgniteInternalCache with the same name. Also it is possible to define
region to cache mapping using properties with prefix org.apache.ignite.hibernate.region_cache.
For example if for region with name "region1" cache with name "cache1" should be used then following
Hibernate property should be specified:
org.apache.ignite.hibernate.region_cache.region1=cache1
| Modifier and Type | Field and Description |
|---|---|
static String |
DFLT_ACCESS_TYPE_PROPERTY |
static String |
DFLT_CACHE_NAME_PROPERTY
Default cache property name.
|
static String |
GRID_CONFIG_PROPERTY |
static String |
GRID_NAME_PROPERTY
Hibernate L2 cache grid name property name.
|
static String |
REGION_CACHE_PROPERTY
Property prefix used to specify region name to cache name mapping.
|
| Constructor and Description |
|---|
HibernateRegionFactory() |
| Modifier and Type | Method and Description |
|---|---|
org.hibernate.cache.spi.CollectionRegion |
buildCollectionRegion(String regionName,
Properties props,
org.hibernate.cache.spi.CacheDataDescription metadata) |
org.hibernate.cache.spi.EntityRegion |
buildEntityRegion(String regionName,
Properties props,
org.hibernate.cache.spi.CacheDataDescription metadata) |
org.hibernate.cache.spi.NaturalIdRegion |
buildNaturalIdRegion(String regionName,
Properties props,
org.hibernate.cache.spi.CacheDataDescription metadata) |
org.hibernate.cache.spi.QueryResultsRegion |
buildQueryResultsRegion(String regionName,
Properties props) |
org.hibernate.cache.spi.TimestampsRegion |
buildTimestampsRegion(String regionName,
Properties props) |
org.hibernate.cache.spi.access.AccessType |
getDefaultAccessType() |
boolean |
isMinimalPutsEnabledByDefault() |
long |
nextTimestamp() |
void |
start(org.hibernate.cfg.Settings settings,
Properties props) |
void |
stop() |
public static final String GRID_NAME_PROPERTY
public static final String DFLT_CACHE_NAME_PROPERTY
public static final String REGION_CACHE_PROPERTY
public static final String DFLT_ACCESS_TYPE_PROPERTY
public static final String GRID_CONFIG_PROPERTY
public void start(org.hibernate.cfg.Settings settings,
Properties props)
throws org.hibernate.cache.CacheException
start in interface org.hibernate.cache.spi.RegionFactoryorg.hibernate.cache.CacheExceptionpublic void stop()
stop in interface org.hibernate.cache.spi.RegionFactorypublic boolean isMinimalPutsEnabledByDefault()
isMinimalPutsEnabledByDefault in interface org.hibernate.cache.spi.RegionFactorypublic org.hibernate.cache.spi.access.AccessType getDefaultAccessType()
getDefaultAccessType in interface org.hibernate.cache.spi.RegionFactorypublic long nextTimestamp()
nextTimestamp in interface org.hibernate.cache.spi.RegionFactorypublic org.hibernate.cache.spi.EntityRegion buildEntityRegion(String regionName, Properties props, org.hibernate.cache.spi.CacheDataDescription metadata) throws org.hibernate.cache.CacheException
buildEntityRegion in interface org.hibernate.cache.spi.RegionFactoryorg.hibernate.cache.CacheExceptionpublic org.hibernate.cache.spi.NaturalIdRegion buildNaturalIdRegion(String regionName, Properties props, org.hibernate.cache.spi.CacheDataDescription metadata) throws org.hibernate.cache.CacheException
buildNaturalIdRegion in interface org.hibernate.cache.spi.RegionFactoryorg.hibernate.cache.CacheExceptionpublic org.hibernate.cache.spi.CollectionRegion buildCollectionRegion(String regionName, Properties props, org.hibernate.cache.spi.CacheDataDescription metadata) throws org.hibernate.cache.CacheException
buildCollectionRegion in interface org.hibernate.cache.spi.RegionFactoryorg.hibernate.cache.CacheExceptionpublic org.hibernate.cache.spi.QueryResultsRegion buildQueryResultsRegion(String regionName, Properties props) throws org.hibernate.cache.CacheException
buildQueryResultsRegion in interface org.hibernate.cache.spi.RegionFactoryorg.hibernate.cache.CacheExceptionpublic org.hibernate.cache.spi.TimestampsRegion buildTimestampsRegion(String regionName, Properties props) throws org.hibernate.cache.CacheException
buildTimestampsRegion in interface org.hibernate.cache.spi.RegionFactoryorg.hibernate.cache.CacheException
Follow @ApacheIgnite
Ignite Fabric : ver. 1.5.11 Release Date : April 8 2016