Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


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, pp 2009.01.23

Field Summary

 

Fields inherited from class com.tangosol.coherence.hibernate.HibernateCacheLoader
PARAM_IDS

 

Constructor Summary
HibernateCacheStore()
          Default constructor.
HibernateCacheStore(java.lang.String entityName)
          Constructor which accepts an entityName
HibernateCacheStore(java.lang.String sEntityName, java.io.File configurationFile)
          Constructor which accepts an entityName and a hibernate configuration resource.
HibernateCacheStore(java.lang.String sEntityName, SessionFactory sessionFactory)
          Constructor which accepts an entityName and a Hibernate SessionFactory.
HibernateCacheStore(java.lang.String sEntityName, java.lang.String sResource)
          Constructor which accepts an entityName and a hibernate configuration resource.

 

Method Summary
 void erase(java.lang.Object key)
          Erase a Hibernate entity given an id (key)
 void eraseAll(java.util.Collection keys)
          Erase a set of Hibernate entities given an collection of ids (keys)
 void store(java.lang.Object key, java.lang.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(java.util.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, setEntityName, setLoadAllQuery, setSessionFactory, validateIdentifier

 

Methods inherited from interface com.tangosol.net.cache.CacheLoader
load, loadAll

 

Constructor Detail

HibernateCacheStore

public HibernateCacheStore()
Default constructor. If using this constructor, it is expected that the entityName and sessionFactory attributes will be set prior to usage.

HibernateCacheStore

public HibernateCacheStore(java.lang.String entityName)
Constructor which accepts an entityName
Parameters:
entityName - the Hibernate entity (the fully-qualified class name)

HibernateCacheStore

public HibernateCacheStore(java.lang.String sEntityName,
                           java.lang.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(java.lang.String sEntityName,
                           java.io.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(java.lang.String sEntityName,
                           SessionFactory sessionFactory)
Constructor which accepts an entityName and a Hibernate SessionFactory. 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(java.lang.Object key,
                  java.lang.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(java.util.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(java.lang.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(java.util.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

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.