org.apache.ignite.cache.store.jdbc

## Class CacheJdbcPojoStore<K,V>

- java.lang.Object
- - org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore<K,V>
  - - org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore<K,V>

All Implemented Interfaces:
  javax.cache.integration.CacheLoader<K,V>, javax.cache.integration.CacheWriter<K,V>, CacheStore<K,V>, LifecycleAware

    public class CacheJdbcPojoStore<K,V>
    extends CacheAbstractJdbcStore<K,V>

Implementation of `CacheStore` backed by JDBC and POJO via reflection. This implementation stores objects in underlying database using java beans mapping description via reflection.

Use `CacheJdbcPojoStoreFactory` factory to pass `CacheJdbcPojoStore` to `CacheConfiguration`.

### Nested Class Summary

Nested Classes
`protected static class` `CacheJdbcPojoStore.PojoMethodsCache` POJO methods cache.

### Nested classes/interfaces inherited from class org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore

`CacheAbstractJdbcStore.EntryMapping`

### Field Summary

Fields
`protected Map<String,Map<String,CacheJdbcPojoStore.PojoMethodsCache>>` `mtdsCache` Methods cache.

### Fields inherited from class org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore

`ATTR_CONN_PROP, cacheMappings, dataSrc, DFLT_BATCH_SIZE, DFLT_PARALLEL_LOAD_CACHE_MINIMUM_THRESHOLD, dialect, EMPTY_COLUMN_VALUE, log, MAX_ATTEMPT_WRITE_COUNT`

### Constructor Summary

Constructors
Constructor and Description
`CacheJdbcPojoStore()`

### Method Summary

Methods
`protected <R> R` `buildObject(String cacheName, String typeName, Collection<CacheTypeFieldMetadata> fields, Map<String,Integer> loadColIdxs, ResultSet rs)` Construct object from query result.
`protected Object` `extractParameter(String cacheName, String typeName, String fieldName, Object obj)` Get field value from object for use as query parameter.
`protected Object` `keyTypeId(Object key)` Extract key type id from key object.
`protected Object` `keyTypeId(String type)` Extract key type id from key class name.
`protected void` `prepareBuilders(String cacheName, Collection<CacheTypeMetadata> types)` Prepare internal store specific builders for provided types metadata.

### Methods inherited from class org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore

`closeConnection, connection, delete, deleteAll, end, fillKeyParameters, fillKeyParameters, fillParameter, fillValueParameters, getBatchSize, getColumnValue, getDataSource, getDialect, getMaximumPoolSize, getParallelLoadCacheMinimumThreshold, ignite, load, loadAll, loadCache, openConnection, resolveDialect, session, sessionEnd, setBatchSize, setDataSource, setDialect, setMaximumPoolSize, setParallelLoadCacheMinimumThreshold, simpleType, start, stop, write, writeAll`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### mtdsCache

    protected volatile Map<String,Map<String,CacheJdbcPojoStore.PojoMethodsCache>> mtdsCache

Methods cache.

### Constructor Detail

#### CacheJdbcPojoStore

    public CacheJdbcPojoStore()

### Method Detail

#### prepareBuilders

    protected void prepareBuilders(@Nullable
                       String cacheName,
                       Collection<CacheTypeMetadata> types)
                            throws javax.cache.CacheException

Prepare internal store specific builders for provided types metadata.

Specified by:
  `prepareBuilders` in class `CacheAbstractJdbcStore<K,V>`
  `types` - Collection of types.
Throws:
  `javax.cache.CacheException` - If failed to prepare internal builders for types.

#### buildObject

    protected <R> R buildObject(String cacheName,
                    String typeName,
                    Collection<CacheTypeFieldMetadata> fields,
                    Map<String,Integer> loadColIdxs,
                    ResultSet rs)
                     throws javax.cache.integration.CacheLoaderException

Construct object from query result.

Specified by:
  `buildObject` in class `CacheAbstractJdbcStore<K,V>`
Type Parameters:
  `R` - Type of result object.
Parameters:
  `cacheName` - Cache name.
  `typeName` - Type name.
  `fields` - Fields descriptors.
  `loadColIdxs` - Select query columns index.
  `rs` - ResultSet.
Returns:
  Constructed object.
Throws:
  `javax.cache.integration.CacheLoaderException` - If failed to construct cache object.

#### extractParameter

    @Nullable
    protected Object extractParameter(String cacheName,
                                   String typeName,
                                   String fieldName,
                                   Object obj)
                               throws javax.cache.CacheException

Get field value from object for use as query parameter.

Specified by:
  `extractParameter` in class `CacheAbstractJdbcStore<K,V>`
Parameters:
  `cacheName` - Cache name.
  `typeName` - Type name.
  `fieldName` - Field name.
  `obj` - Cache object.
Returns:
  Field value from object.
Throws:
  `javax.cache.CacheException`

#### keyTypeId

    protected Object keyTypeId(Object key)
                        throws javax.cache.CacheException

Extract key type id from key object.

Specified by:
  `keyTypeId` in class `CacheAbstractJdbcStore<K,V>`
Parameters:
  `key` - Key object.
Returns:
  Key type id.
Throws:
  `javax.cache.CacheException` - If failed to get type key id from object.

#### keyTypeId

    protected Object keyTypeId(String type)
                        throws javax.cache.CacheException

Extract key type id from key class name.

Specified by:
  `keyTypeId` in class `CacheAbstractJdbcStore<K,V>`
Parameters:
  `type` - String description of key type.
Returns:
  Key type id.
Throws:
  `javax.cache.CacheException` - If failed to get type key id from object.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.2.0-incubating
Release Date | : June 16 2015