IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.hibernate.cache
Class ObjectGridHibernateCacheProvider

java.lang.Object
  extended by com.ibm.ws.objectgrid.hibernate.cache.CommonHibernateCacheProvider
      extended by com.ibm.websphere.objectgrid.hibernate.cache.ObjectGridHibernateCacheProvider
All Implemented Interfaces:
org.hibernate.cache.CacheProvider

public final class ObjectGridHibernateCacheProvider
extends com.ibm.ws.objectgrid.hibernate.cache.CommonHibernateCacheProvider
implements org.hibernate.cache.CacheProvider

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:

  1. objectgrid.configuration: Comma-delimited ObjectGrid configuration properties.
  2. objectgrid.hibernate.regionNames: Comma-delimited Hibernate region names in use. This is optional property and should be specified when regionNames are defined after ObjectGrid cache is initialized. For example, if the Query.setCacheRegion(String regionName) method is executed after ObjectGrid cache initialization. This regionName could be a new regionName to cache and there won't be a corresponding BackingMap for it. To have better performance, these regionNames should be included in this property. If not, all regionNames that are determined dynamically will use a shared default BackingMap.

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" />

 

Since:
WAS XD 6.1.0.3

Field Summary
 
Fields inherited from class com.ibm.ws.objectgrid.hibernate.cache.CommonHibernateCacheProvider
lineBreak
 
Constructor Summary
ObjectGridHibernateCacheProvider()
           
 
Method Summary
 org.hibernate.cache.Cache buildCache(String regionName, Properties props)
           
protected  String getCacheStatistics()
          Note: This method is accessed reflection and used for testing and debugging.
protected  void processWriteBehind(boolean checkSize)
          Overrides
protected  void setPreLoadMode(boolean preLoadMode)
          Overrides
 
Methods inherited from class com.ibm.ws.objectgrid.hibernate.cache.CommonHibernateCacheProvider
addCacheProvider, addRegionName, dumplObjectGridConfiguration, getAgentOperator, getCounterProcessWriteBehind, getObjectGrid, getObjectGridName, getObjectGridResource, getPreloadBatchSize, getPuName, getTypeNames, getWriteBehindInterval, getWriteBehindMaxBatchSize, getWriteBehindPoolSize, handleTypeNames, handleWriteBehind, isMinimalPutsEnabledByDefault, isPreLoadMode, isWriteBehind, nextTimestamp, parseObjectGridConfiguration, preload, preload, processObjectGridConfiguration, processObjectgridHibernateRegionNames, setDefaultPersistanceUnitName, setHibernateConf, setObjectGridConfigurationProperty, setPreloadBatchSize, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.cache.CacheProvider
isMinimalPutsEnabledByDefault, nextTimestamp, start, stop
 

Constructor Detail

ObjectGridHibernateCacheProvider

public ObjectGridHibernateCacheProvider()
Method Detail

buildCache

public org.hibernate.cache.Cache buildCache(String regionName,
                                            Properties props)
                                     throws org.hibernate.cache.CacheException
Specified by:
buildCache in interface org.hibernate.cache.CacheProvider
Throws:
org.hibernate.cache.CacheException
See Also:
CacheProvider.buildCache(java.lang.String, java.util.Properties)

setPreLoadMode

protected void setPreLoadMode(boolean preLoadMode)
Overrides

Overrides:
setPreLoadMode in class com.ibm.ws.objectgrid.hibernate.cache.CommonHibernateCacheProvider

processWriteBehind

protected void processWriteBehind(boolean checkSize)
Overrides

Overrides:
processWriteBehind in class com.ibm.ws.objectgrid.hibernate.cache.CommonHibernateCacheProvider

getCacheStatistics

protected String getCacheStatistics()
Note: This method is accessed reflection and used for testing and debugging. Do not remove.

Overrides:
getCacheStatistics in class com.ibm.ws.objectgrid.hibernate.cache.CommonHibernateCacheProvider

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.