public class CacheJdbcPojoStore<K,V> extends CacheAbstractJdbcStore<K,V>
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.
CacheAbstractJdbcStore.EntryMapping, CacheAbstractJdbcStore.TypeKindATTR_CONN_PROP, BUILT_IN_TYPES, cacheMappings, dataSrc, dialect, hasher, ignite, log| Constructor and Description |
|---|
CacheJdbcPojoStore() |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
buildBinaryObject(String typeName,
JdbcTypeField[] fields,
Collection<String> hashFields,
Map<String,Integer> loadColIdxs,
ResultSet rs)
Construct binary object from query result.
|
protected <R> R |
buildObject(String cacheName,
String typeName,
CacheAbstractJdbcStore.TypeKind typeKind,
JdbcTypeField[] flds,
Collection<String> hashFlds,
Map<String,Integer> loadColIdxs,
ResultSet rs)
Construct object from query result.
|
protected Object |
extractParameter(String cacheName,
String typeName,
CacheAbstractJdbcStore.TypeKind typeKind,
String fldName,
Object obj)
Get field value from object for use as query parameter.
|
protected void |
prepareBuilders(String cacheName,
Collection<JdbcType> types)
Prepare internal store specific builders for provided types metadata.
|
protected Object |
typeIdForObject(Object obj)
Calculate type ID for object.
|
protected Object |
typeIdForTypeName(CacheAbstractJdbcStore.TypeKind kind,
String typeName)
Calculate type ID for given type name.
|
closeConnection, connection, delete, deleteAll, end, fillKeyParameters, fillKeyParameters, fillParameter, fillValueParameters, getBatchSize, getColumnValue, getDataSource, getDialect, getHasher, getMaximumPoolSize, getMaximumWriteAttempts, getParallelLoadCacheMinimumThreshold, getTypes, ignite, kindForName, load, loadAll, loadCache, openConnection, resolveDialect, session, sessionEnd, setBatchSize, setDataSource, setDialect, setHasher, setMaximumPoolSize, setMaximumWriteAttempts, setParallelLoadCacheMinimumThreshold, setTypes, start, stop, write, writeAll@Nullable protected Object extractParameter(@Nullable String cacheName, String typeName, CacheAbstractJdbcStore.TypeKind typeKind, String fldName, Object obj) throws javax.cache.CacheException
extractParameter in class CacheAbstractJdbcStore<K,V>cacheName - Cache name.typeName - Type name.fldName - Field name.obj - Cache object.typeKind - Type kind.javax.cache.CacheException - in case of error.protected <R> R buildObject(@Nullable String cacheName, String typeName, CacheAbstractJdbcStore.TypeKind typeKind, JdbcTypeField[] flds, Collection<String> hashFlds, Map<String,Integer> loadColIdxs, ResultSet rs) throws javax.cache.integration.CacheLoaderException
buildObject in class CacheAbstractJdbcStore<K,V>R - Type of result object.cacheName - Cache name.typeName - Type name.typeKind - Type kind.flds - Fields descriptors.hashFlds - Field names for hash code calculation.loadColIdxs - Select query columns index.rs - ResultSet.javax.cache.integration.CacheLoaderException - If failed to construct cache object.protected Object buildBinaryObject(String typeName, JdbcTypeField[] fields, Collection<String> hashFields, Map<String,Integer> loadColIdxs, ResultSet rs) throws javax.cache.integration.CacheLoaderException
typeName - Type name.fields - Fields descriptors.hashFields - Collection of fields to build hash for.loadColIdxs - Select query columns index.rs - ResultSet.javax.cache.integration.CacheLoaderException - If failed to construct binary object.protected Object typeIdForObject(Object obj) throws javax.cache.CacheException
typeIdForObject in class CacheAbstractJdbcStore<K,V>obj - Object to calculate type ID for.javax.cache.CacheException - If failed to calculate type ID for given object.protected Object typeIdForTypeName(CacheAbstractJdbcStore.TypeKind kind, String typeName) throws javax.cache.CacheException
typeIdForTypeName in class CacheAbstractJdbcStore<K,V>kind - If true then calculate type ID for POJO otherwise for binary object .typeName - String description of type name.javax.cache.CacheException - If failed to get type ID for given type name.protected void prepareBuilders(@Nullable
String cacheName,
Collection<JdbcType> types)
throws javax.cache.CacheException
prepareBuilders in class CacheAbstractJdbcStore<K,V>cacheName - Cache name to prepare builders for.types - Collection of types.javax.cache.CacheException - If failed to prepare internal builders for types.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.5.11 Release Date : April 8 2016