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 Ignite instance to be used for region factory must be specified as following Hibernate property:
org.apache.ignite.hibernate.ignite_instance_name=<Ignite instance 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
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.boot.spi.SessionFactoryOptions settings,
Properties props) |
void |
stop() |
public void start(org.hibernate.boot.spi.SessionFactoryOptions settings, Properties props) throws org.hibernate.cache.CacheException
start
in interface org.hibernate.cache.spi.RegionFactory
org.hibernate.cache.CacheException
public void stop()
stop
in interface org.hibernate.cache.spi.RegionFactory
public boolean isMinimalPutsEnabledByDefault()
isMinimalPutsEnabledByDefault
in interface org.hibernate.cache.spi.RegionFactory
public org.hibernate.cache.spi.access.AccessType getDefaultAccessType()
getDefaultAccessType
in interface org.hibernate.cache.spi.RegionFactory
public long nextTimestamp()
nextTimestamp
in interface org.hibernate.cache.spi.RegionFactory
public 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.RegionFactory
org.hibernate.cache.CacheException
public 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.RegionFactory
org.hibernate.cache.CacheException
public 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.RegionFactory
org.hibernate.cache.CacheException
public org.hibernate.cache.spi.QueryResultsRegion buildQueryResultsRegion(String regionName, Properties props) throws org.hibernate.cache.CacheException
buildQueryResultsRegion
in interface org.hibernate.cache.spi.RegionFactory
org.hibernate.cache.CacheException
public org.hibernate.cache.spi.TimestampsRegion buildTimestampsRegion(String regionName, Properties props) throws org.hibernate.cache.CacheException
buildTimestampsRegion
in interface org.hibernate.cache.spi.RegionFactory
org.hibernate.cache.CacheException
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019