Class HibernateCacheStore
java.lang.Object
com.tangosol.util.Base
com.oracle.coherence.hibernate.cachestore.HibernateCacheLoader
com.oracle.coherence.hibernate.cachestore.HibernateCacheStore
- All Implemented Interfaces:
com.tangosol.net.cache.CacheLoader
,com.tangosol.net.cache.CacheStore
public class HibernateCacheStore
extends HibernateCacheLoader
implements com.tangosol.net.cache.CacheStore
Data-driven CacheStore implementation for Hibernate tables.
- Author:
- jp 2005.09.15, pp 2009.01.23, rs 2013.09.05, Gunnar Hillert
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
com.tangosol.util.Base.LoggingWriter
-
Field Summary
Fields inherited from class com.oracle.coherence.hibernate.cachestore.HibernateCacheLoader
PARAM_IDS
Fields inherited from class com.tangosol.util.Base
LOG_ALWAYS, LOG_CONFIG, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
-
Constructor Summary
ConstructorDescriptionDefault constructor.HibernateCacheStore
(String entityName) Constructor which accepts an entityName.HibernateCacheStore
(String sEntityName, File configurationFile) Constructor which accepts an entityName and a hibernate configuration resource.HibernateCacheStore
(String sEntityName, String sResource) Constructor which accepts an entityName and a hibernate configuration resource.HibernateCacheStore
(String sEntityName, org.hibernate.SessionFactory sessionFactory) Constructor which accepts an entityName and a HibernateSessionFactory
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Erase a Hibernate entity given an id (key).void
eraseAll
(Collection keys) Erase a set of Hibernate entities given an collection of ids (keys).void
Store a Hibernate entity given an id (key) and entity (value).void
Store a collection of Hibernate entities given a Map of ids (keys) and entities (values).Methods inherited from class com.oracle.coherence.hibernate.cachestore.HibernateCacheLoader
closeSession, createEntityFromId, ensureInitialized, getEntityClassMetadata, getEntityName, getLoadAllQuery, getSessionFactory, initialize, load, loadAll, openSession, setEntityClassMetadata, setEntityName, setLoadAllQuery, setSessionFactory, validateIdentifier
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tangosol.net.cache.CacheLoader
load, loadAll
-
Constructor Details
-
HibernateCacheStore
public HibernateCacheStore()Default constructor. If using this constructor, it is expected that theentityName
andsessionFactory
attributes will be set prior to usage. -
HibernateCacheStore
Constructor which accepts an entityName.- Parameters:
entityName
- the Hibernate entity (the fully-qualified class name)
-
HibernateCacheStore
Constructor which accepts an entityName and a hibernate configuration resource. The current implementation instantiates a SessionFactory per instance (implying one instance per CacheStore-backed NamedCache).- Parameters:
sEntityName
- the Hibernate entity (i.e. the HQL table name)sResource
- the Hibernate config classpath resource (e.g. hibernate.cfg.xml)
-
HibernateCacheStore
Constructor which accepts an entityName and a hibernate configuration resource. The current implementation instantiates a SessionFactory per instance (implying one instance per CacheStore-backed NamedCache).- Parameters:
sEntityName
- the Hibernate entity (i.e. the HQL table name)configurationFile
- the Hibernate config file (e.g. hibernate.cfg.xml)
-
HibernateCacheStore
Constructor which accepts an entityName and a HibernateSessionFactory
. This allows for external configuration of the SessionFactory (for instance using Spring.)- Parameters:
sEntityName
- the Hibernate entity (i.e. the HQL table name)sessionFactory
- the Hibernate SessionFactory
-
-
Method Details
-
store
Store a Hibernate entity given an id (key) and entity (value).The entity must have an identifier attribute, and it must be either null (undefined) or equal to the cache key.
- Specified by:
store
in interfacecom.tangosol.net.cache.CacheStore
- Parameters:
key
- the cache key; specifically, the entity idvalue
- the cache value; specifically, the entity
-
storeAll
Store a collection of Hibernate entities given a Map of ids (keys) and entities (values).- Specified by:
storeAll
in interfacecom.tangosol.net.cache.CacheStore
- Parameters:
entries
- a mapping of ids (keys) to entities (values)
-
erase
Erase a Hibernate entity given an id (key).- Specified by:
erase
in interfacecom.tangosol.net.cache.CacheStore
- Parameters:
key
- the cache key; specifically, the entity id
-
eraseAll
Erase a set of Hibernate entities given an collection of ids (keys).- Specified by:
eraseAll
in interfacecom.tangosol.net.cache.CacheStore
- Parameters:
keys
- the cache keys; specifically, the entity ids
-