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.TypeKind
ATTR_CONN_PROP, BUILT_IN_TYPES, cacheMappings, dataSrc, dialect, hasher, ignite, log, transformer
Constructor and Description |
---|
CacheJdbcPojoStore() |
Modifier and Type | Method and Description |
---|---|
protected Object |
buildBinaryObject(String typeName,
JdbcTypeField[] fields,
Map<String,Integer> loadColIdxs,
ResultSet rs)
Construct binary object from query result.
|
protected <R> R |
buildObject(@Nullable String cacheName,
String typeName,
CacheAbstractJdbcStore.TypeKind typeKind,
JdbcTypeField[] flds,
Map<String,Integer> loadColIdxs,
ResultSet rs)
Construct object from query result.
|
protected @Nullable Object |
extractParameter(@Nullable String cacheName,
String typeName,
CacheAbstractJdbcStore.TypeKind typeKind,
String fldName,
Object obj)
Get field value from object for use as query parameter.
|
protected void |
prepareBuilders(@Nullable String cacheName,
Collection<JdbcType> types)
Prepare internal store specific builders for provided types metadata.
|
String |
toString() |
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, columnIndex, connection, delete, deleteAll, end, fillKeyParameters, fillKeyParameters, fillParameter, fillValueParameters, getBatchSize, getDataSource, getDialect, getHasher, getMaximumPoolSize, getMaximumWriteAttempts, getParallelLoadCacheMinimumThreshold, getTransformer, getTypes, ignite, isSqlEscapeAll, kindForName, kindForName, load, loadAll, loadCache, openConnection, resolveDialect, session, sessionEnd, setBatchSize, setDataSource, setDialect, setHasher, setMaximumPoolSize, setMaximumWriteAttempts, setParallelLoadCacheMinimumThreshold, setSqlEscapeAll, setTransformer, setTypes, start, stop, write, writeAll
@Nullable protected @Nullable Object extractParameter(@Nullable @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 @Nullable String cacheName, String typeName, CacheAbstractJdbcStore.TypeKind typeKind, JdbcTypeField[] flds, 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.loadColIdxs
- Select query columns index.rs
- ResultSet.javax.cache.integration.CacheLoaderException
- If failed to construct cache object.protected Object buildBinaryObject(String typeName, JdbcTypeField[] fields, Map<String,Integer> loadColIdxs, ResultSet rs) throws javax.cache.integration.CacheLoaderException
typeName
- Type name.fields
- Fields descriptors.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 @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.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024