CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.coherence.hibernate
Class HibernateCacheStore

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.coherence.hibernate.HibernateCacheLoader
          extended by com.tangosol.coherence.hibernate.HibernateCacheStore
All Implemented Interfaces:
CacheLoader, CacheStore

public class HibernateCacheStore
extends HibernateCacheLoader
implements CacheStore

Data-driven CacheStore implementation for Hibernate tables

Author:
jp 2005.09.15

Field Summary
 
Fields inherited from class com.tangosol.coherence.hibernate.HibernateCacheLoader
PARAM_IDS
 
Constructor Summary
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.
 
Method Summary
 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)

The entity must have an identifier attribute, and it must be either null (undefined) or equal to the cache key.

 void storeAll(Map entries)
          Store a collection of Hibernate entities given a Map of ids (keys) and entities (values)
 
Methods inherited from class com.tangosol.coherence.hibernate.HibernateCacheLoader
closeSession, createEntityFromId, ensureInitialized, getEntityClassMetadata, getEntityName, getLoadAllQuery, getSessionFactory, initialize, load, loadAll, openSession, setEntityClassMetadata, setLoadAllQuery, validateIdentifier
 
Methods inherited from interface com.tangosol.net.cache.CacheLoader
load, loadAll
 

Constructor Detail

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)
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 interface CacheStore
Parameters:
key - the cache key; specifically, the entity id
value - 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 interface 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 interface 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 interface CacheStore
Parameters:
keys - the cache keys; specifically, the entity ids

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation