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

com.tangosol.coherence.toplink
Class TopLinkCacheStore

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.coherence.toplink.TopLinkCacheLoader
          extended by com.tangosol.coherence.toplink.TopLinkCacheStore
All Implemented Interfaces:
CacheLoader, CacheStore

public class TopLinkCacheStore
extends TopLinkCacheLoader
implements CacheStore

TopLink implementation of the CacheStore interface.

Use this class as a full load and store implementation that uses TopLink to load and store entities to and from a data store. The entities must be mapped to the data store and a TopLink session configuration or TopLink JPA persistence unit configuration must exist on the classpath.

Author:
mlk 2007.04.20, jh 2007.05.18

Field Summary
 
Fields inherited from class com.tangosol.coherence.toplink.TopLinkCacheLoader
m_clzEntity, m_descEntity, m_fUsePkClass, m_mappingPk, m_sEntityName, m_session, m_sPkField
 
Constructor Summary
TopLinkCacheStore(String sEntityName)
          Constructor which accepts an entity name.
TopLinkCacheStore(String sEntityName, String sSessionName)
          Constructor which accepts an entity name and session name.
 
Method Summary
 void erase(Object oKey)
          Remove the specified key from the underlying store if present.
 void eraseAll(Collection colKeys)
          Remove the specified keys from the underlying store if present.
 void store(Object oKey, Object oValue)
          Store the specified value under the specified key in the underlying store.
 void storeAll(Map mapEntries)
          Store the specified values under the specified keys in the underlying store.
 
Methods inherited from class com.tangosol.coherence.toplink.TopLinkCacheLoader
initialize, load, loadAll, queryByPk, queryByPkCollection
 
Methods inherited from interface com.tangosol.net.cache.CacheLoader
load, loadAll
 

Constructor Detail

TopLinkCacheStore

public TopLinkCacheStore(String sEntityName)
Constructor which accepts an entity name.

Parameters:
sEntityName - the alias for the persistent class

TopLinkCacheStore

public TopLinkCacheStore(String sEntityName,
                         String sSessionName)
Constructor which accepts an entity name and session name.

Parameters:
sEntityName - the alias for the persistent class
sSessionName - the name of the TopLink session (usually defined in sessions.xml)
Method Detail

store

public void store(Object oKey,
                  Object oValue)
Store the specified value under the specified key in the underlying store. This method is intended to support both key/value creation and value update for a specific key.

Specified by:
store in interface CacheStore
Parameters:
oKey - key to store the value under
oValue - value to be stored

storeAll

public void storeAll(Map mapEntries)
Store the specified values under the specified keys in the underlying store. This method is intended to support both key/value creation and value update for the specified keys.

Specified by:
storeAll in interface CacheStore
Parameters:
mapEntries - a Map of any number of keys and values to store

erase

public void erase(Object oKey)
Remove the specified key from the underlying store if present.

Specified by:
erase in interface CacheStore
Parameters:
oKey - key whose mapping is being removed from the cache

eraseAll

public void eraseAll(Collection colKeys)
Remove the specified keys from the underlying store if present.

Specified by:
eraseAll in interface CacheStore
Parameters:
colKeys - keys whose mappings are being removed from the cache

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