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
-
-
Field Summary
-
Fields inherited from class com.oracle.coherence.hibernate.cachestore.HibernateCacheLoader
PARAM_IDS
-
-
Constructor Summary
Constructors Constructor Description HibernateCacheStore()
Default constructor.HibernateCacheStore(String entityName)
Constructor which accepts an entityNameHibernateCacheStore(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
erase(Object key)
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(Object key, Object value)
Store a Hibernate entity given an id (key) and entity (value)void
storeAll(Map entries)
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
-
-
-
-
Constructor Detail
-
HibernateCacheStore
public HibernateCacheStore()
Default constructor. If using this constructor, it is expected that theentityName
andsessionFactory
attributes will be set prior to usage.
-
HibernateCacheStore
public HibernateCacheStore(String entityName)
Constructor which accepts an entityName- Parameters:
entityName
- the Hibernate entity (the fully-qualified class name)
-
HibernateCacheStore
public HibernateCacheStore(String sEntityName, String sResource)
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
- Hibernate entity (i.e. the HQL table name)sResource
- Hibernate config classpath resource (e.g. hibernate.cfg.xml)
-
HibernateCacheStore
public HibernateCacheStore(String sEntityName, File configurationFile)
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
- Hibernate entity (i.e. the HQL table name)configurationFile
- Hibernate config file (e.g. hibernate.cfg.xml)
-
HibernateCacheStore
public HibernateCacheStore(String sEntityName, org.hibernate.SessionFactory sessionFactory)
Constructor which accepts an entityName and a HibernateSessionFactory
. This allows for external configuration of the SessionFactory (for instance using Spring.)- Parameters:
sEntityName
- Hibernate entity (i.e. the HQL table name)sessionFactory
- Hibernate SessionFactory
-
-
Method Detail
-
store
public void store(Object key, Object value)
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
public void storeAll(Map entries)
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
public void erase(Object key)
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
public void eraseAll(Collection keys)
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
-
-