Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.coherence.toplink
Class TopLinkCacheLoader

`java.lang.Object
com.tangosol.util.Base
com.tangosol.coherence.toplink.TopLinkCacheLoader`

All Implemented Interfaces:
  CacheLoader

Direct Known Subclasses:
  TopLinkCacheStore

      public class TopLinkCacheLoader

extends Base
implements CacheLoader

TopLink implementation of the `CacheLoader` interface. <p/> Use this class as a load-only implementation that uses TopLink to load 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. <p/> Use the `TopLinkCacheStore` class for a full load and store implementation.

Author:
  mlk 2007.04.20, jh 2005.05.18
See Also:
  `TopLinkCacheStore`

Field Summary
`protected Class` | `m_clzEntity` The entity class that this CacheLoader is managing.
`protected oracle.toplink.essentials.descriptors.ClassDescriptor` | `m_descEntity` Descriptor for entity class.
`protected boolean` | `m_fUsePkClass` Flag to indicate whether or not the PK is a composite class.
`protected oracle.toplink.essentials.mappings.DatabaseMapping` | `m_mappingPk` Database mapping of the PK attribute.
`protected String` | `m_sEntityName` Name of the entity that this CacheLoader is managing.
`protected oracle.toplink.essentials.sessions.Session` | `m_session` Shared session for all entities.
`protected String` | `m_sPkField` Field name of the PK attribute.

Constructor Summary
`TopLinkCacheLoader(String sEntityName)` Constructor which accepts an entity name.
`TopLinkCacheLoader(String sEntityName, String sSessionName)` Constructor which accepts an entity name and session name.

Method Summary
`protected void` | `initialize(String sEntityName, String sSessionName)` Initialize the instance with the relevant metadata for the entity being stored.
`Object` | `load(Object oKey)` Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
`Map` | `loadAll(Collection colKeys)` Return the values associated with each the specified keys in the passed collection.
`protected Object` | `queryByPk(oracle.toplink.essentials.sessions.UnitOfWork uow, Object oKey)` Internal method to create and execute a "findByPK" query.
`protected Object` | `queryByPkCollection(oracle.toplink.essentials.sessions.UnitOfWork uow, Collection colPk)` Internal method to create and execute a query to find in a group of PKs.

Field Detail

### m_sEntityName

    protected String m_sEntityName

  Name of the entity that this CacheLoader is managing.

### m_clzEntity

    protected Class m_clzEntity

  The entity class that this CacheLoader is managing.

### m_fUsePkClass

    protected boolean m_fUsePkClass

  Flag to indicate whether or not the PK is a composite class.

### m_mappingPk

    protected oracle.toplink.essentials.mappings.DatabaseMapping m_mappingPk

  Database mapping of the PK attribute.

### m_sPkField

    protected String m_sPkField

  Field name of the PK attribute.

### m_descEntity

    protected oracle.toplink.essentials.descriptors.ClassDescriptor m_descEntity

  Descriptor for entity class.

### m_session

    protected oracle.toplink.essentials.sessions.Session m_session

  Shared session for all entities.

Constructor Detail

### TopLinkCacheLoader

    public TopLinkCacheLoader(String sEntityName)

  Constructor which accepts an entity name.
  Parameters:
    `sEntityName` - the alias for the persistent class

### TopLinkCacheLoader

    public TopLinkCacheLoader(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

### load

    public Object load(Object oKey)

  Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
  Specified by:
    `load` in interface `CacheLoader`
  Parameters:
    `oKey` - key whose associated value is to be returned
  Returns:
    the value associated with the specified key, or `null` if no value is available for that key

### loadAll

    public Map loadAll(Collection colKeys)

  Return the values associated with each the specified keys in the passed collection. If a key does not have an associated value in the underlying store, then the return map will not have an entry for that key.
  Specified by:
    `loadAll` in interface `CacheLoader`
  Parameters:
    `colKeys` - a collection of keys to load
  Returns:
    a Map of keys to associated values for the specified keys

### initialize

    protected void initialize(String sEntityName,
                              String sSessionName)

  Initialize the instance with the relevant metadata for the entity being stored.
  Parameters:
    `sEntityName` - the alias for the persistent class
    `sSessionName` - the name of the TopLink session

### queryByPk

    protected Object queryByPk(oracle.toplink.essentials.sessions.UnitOfWork uow,
                               Object oKey)

  Internal method to create and execute a "findByPK" query.
  Parameters:
    `uow` - the unit of work to use for the operation; if null use the session
    `oKey` - the primary key to use to find the object
  Returns:
    the found object, or null if not found

### queryByPkCollection

    protected Object queryByPkCollection(oracle.toplink.essentials.sessions.UnitOfWork uow,
                                         Collection colPk)

  Internal method to create and execute a query to find in a group of PKs. <p/> This method assumes that the entity has a simple PK and not a PK class, and the Collection passed in is one of simple PK value objects. This method should not be used when the entity has a PK class.
  Parameters:
    `uow` - the unit of work to use for the operation; if null use the session
    `colPk` - the Collection of primary keys to use to find the entity instances
  Returns:
    the Collection of entities with a PK matching any of the specified PKs

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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