|
IBM WebSphereTM eXtreme Scale, Release 8.5 API Specification |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.websphere.objectgrid.hibernate.cache.ObjectGridHibernateCacheProvider
public final class ObjectGridHibernateCacheProvider
The ObjectGridHibernateCacheProvider is the implementation of Hibernate CacheProvider. Users can enable ObjectGrid as level 2 cache for Hibernate by configuring cache provider property in the Hibernate configuration file.
If using Hibernate as a JPA provider, the cache provider property name in persistence.xml is hibernate.cache.provider_class:
<property name="hibernate.cache.provider_class" value="com.ibm.websphere.objectgrid.hibernate.cache.ObjectGridHibernateCacheProvider" />
If using the traditional Hibernate configuration, the cache provider property name is cache.provider_class:
<property name="cache.provider_class"> com.ibm.websphere.objectgrid.hibernate.cache.ObjectGridHibernateCacheProvider </property>
The following additional properties apply to the ObjectGrid:
The following is a configuration example of JPA persistence.xml file.
<property name="hibernate.cache.provider_class" value="com.ibm.websphere.objectgrid.hibernate.cache.ObjectGridHibernateCacheProvider" /> <property name="hibernate.cache.use_query_cache" value="true" /> <property name="objectgrid.configuration" value="ObjectGridName=MyObjectGridName, ObjectGridType=EMBEDDED , MaxNumberOfReplicas=47" /> <property name="objectgrid.hibernate.regionNames" value="queryRegion1, queryRegion2" />
Constructor Summary | |
---|---|
ObjectGridHibernateCacheProvider()
The default constructor. |
Method Summary | |
---|---|
org.hibernate.cache.Cache |
buildCache(String regionName,
Properties props)
|
int |
getPreloadBatchSize()
Return the batch size of the preload process. |
String |
getPuName()
Return the persistence unit name of the corresponding persistence unit. |
Set |
getTypeNames()
Return the collection of type names used to create BackingMaps of the ObjectGrid. |
boolean |
isMinimalPutsEnabledByDefault()
|
boolean |
isPreLoadMode()
Return true if the cache provider is preloading data. |
long |
nextTimestamp()
|
static void |
preload(String objectGridName,
EntityManagerFactory emf,
Class theClass,
int fetchSize,
int maxRecords)
Preload Hibernate entities into the ObjectGrid cache using the Hibernate JPA EntityManagerFactory. |
static void |
preload(String objectGridName,
org.hibernate.SessionFactory sF,
Class theClass,
int fetchSize,
int maxRecords)
Preload records from a database into the cache. |
void |
setPreloadBatchSize(int preloadBatchSize)
Set the batch size of the preload process |
void |
start(Properties configProperty)
|
void |
stop()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectGridHibernateCacheProvider()
Method Detail |
---|
public org.hibernate.cache.Cache buildCache(String regionName, Properties props) throws org.hibernate.cache.CacheException
buildCache
in interface org.hibernate.cache.CacheProvider
org.hibernate.cache.CacheException
CacheProvider.buildCache(java.lang.String, java.util.Properties)
public boolean isMinimalPutsEnabledByDefault()
isMinimalPutsEnabledByDefault
in interface org.hibernate.cache.CacheProvider
CacheProvider.isMinimalPutsEnabledByDefault()
public long nextTimestamp()
nextTimestamp
in interface org.hibernate.cache.CacheProvider
CacheProvider.nextTimestamp()
public void start(Properties configProperty) throws org.hibernate.cache.CacheException
start
in interface org.hibernate.cache.CacheProvider
org.hibernate.cache.CacheException
CacheProvider.start(java.util.Properties)
public void stop()
stop
in interface org.hibernate.cache.CacheProvider
CacheProvider.stop()
public String getPuName()
public Set getTypeNames()
public boolean isPreLoadMode()
public int getPreloadBatchSize()
public void setPreloadBatchSize(int preloadBatchSize)
preloadBatchSize
- public static void preload(String objectGridName, org.hibernate.SessionFactory sF, Class theClass, int fetchSize, int maxRecords)
objectGridName
- the objectGrid name configured for the cache of persistence unit.sF
- Hibernate SessionFactory to usetheClass
- The class corresponding to the database table to loadfetchSize
- The number of records to fetch from the database at oncemaxRecords
- If > 0 this is the maximum record count to preload.public static void preload(String objectGridName, EntityManagerFactory emf, Class theClass, int fetchSize, int maxRecords)
objectGridName
- the objectGrid name configured for the cache of persistence unit.emf
- The Hibernate JPA EntityManagerFactory to use to interact with Hibernate.theClass
- The class corresponding to the database table to loadfetchSize
- The number of records to fetch from the database at oncemaxRecords
- If > 0 this is the maximum record count to preload.
|
IBM WebSphereTM eXtreme Scale, Release 8.5 API Specification |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |