Class CacheJdbcPojoStoreFactory<K,V>
- java.lang.Object
-
- org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory<K,V>
-
- All Implemented Interfaces:
Serializable
,javax.cache.configuration.Factory<CacheAbstractJdbcStore<K,V>>
public class CacheJdbcPojoStoreFactory<K,V> extends Object implements javax.cache.configuration.Factory<CacheAbstractJdbcStore<K,V>>
Factory
implementation forCacheJdbcPojoStore
. Use this factory to passCacheJdbcPojoStore
toCacheConfiguration
.Please note, that
setDataSource(DataSource)
is deprecated andsetDataSourceFactory(Factory)
orsetDataSourceBean(String)
should be used instead.Spring Example
<bean id= "myDataSource" class="org.h2.jdbcx.JdbcDataSource"/> <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> ... <property name="cacheConfiguration"> <list> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="myCache" /> ... <property name="cacheStoreFactory"> <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory"> <property name="dataSourceBean" value="myDataSource" /> <property name="types"> <list> <bean class="org.apache.ignite.cache.store.jdbc.JdbcType"> <property name="cacheName" value="myCache" /> <property name="databaseSchema" value="MY_DB_SCHEMA" /> <property name="databaseTable" value="PERSON" /> <property name="keyType" value="java.lang.Integer" /> <property name="keyFields"> <list> <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField"> <property name="databaseFieldType" > <util:constant static-field="java.sql.Types.INTEGER"/> </property> <property name="databaseFieldName" value="ID" /> <property name="javaFieldType" value="java.lang.Integer" /> <property name="javaFieldName" value="id" /> </bean> </list> </property> <property name="valueType" value="my.company.Person" /> <property name="valueFields"> <list> <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField"> <property name="databaseFieldType" > <util:constant static-field="java.sql.Types.VARCHAR"/> </property> <property name="databaseFieldName" value="NAME" /> <property name="javaFieldType" value="java.lang.String" /> <property name="javaFieldName" value="name" /> </bean> </list> </property> </bean> </list> </property> </bean> </property> </bean> </list> </property> </bean>
For information about Spring framework visit www.springframework.org- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DFLT_BATCH_SIZE
Default batch size for put and remove operations.static int
DFLT_PARALLEL_LOAD_CACHE_MINIMUM_THRESHOLD
Default batch size for put and remove operations.static int
DFLT_WRITE_ATTEMPTS
Default value for write attempts.
-
Constructor Summary
Constructors Constructor Description CacheJdbcPojoStoreFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CacheJdbcPojoStore<K,V>
create()
int
getBatchSize()
Get maximum batch size for write and delete operations.String
getDataSourceBean()
Gets name of the data source bean.javax.cache.configuration.Factory<DataSource>
getDataSourceFactory()
Gets factory for underlying datasource.JdbcDialect
getDialect()
Get database dialect.JdbcTypeHasher
getHasher()
Gets hash code calculator.int
getMaximumPoolSize()
Get maximum workers thread count.int
getMaximumWriteAttempts()
Gets maximum number of write attempts in case of database error.int
getParallelLoadCacheMinimumThreshold()
Parallel load cache minimum row count threshold.JdbcTypesTransformer
getTransformer()
Gets types transformer.JdbcType[]
getTypes()
Gets types known by store.boolean
isSqlEscapeAll()
Iftrue
all the SQL table and field names will be escaped with double quotes like ("tableName"."fieldsName"
).CacheJdbcPojoStoreFactory
setBatchSize(int batchSize)
Set maximum batch size for write and delete operations.CacheJdbcPojoStoreFactory<K,V>
setDataSource(DataSource dataSrc)
Deprecated.CacheJdbcPojoStoreFactory
setDataSourceBean(String dataSrcBean)
Sets name of the data source bean.CacheJdbcPojoStoreFactory<K,V>
setDataSourceFactory(javax.cache.configuration.Factory<DataSource> dataSrcFactory)
Sets factory for underlying datasource.CacheJdbcPojoStoreFactory
setDialect(JdbcDialect dialect)
Set database dialect.CacheJdbcPojoStoreFactory
setHasher(JdbcTypeHasher hasher)
Sets hash code calculator.CacheJdbcPojoStoreFactory
setMaximumPoolSize(int maxPoolSize)
Set Maximum workers thread count.CacheJdbcPojoStoreFactory
setMaximumWriteAttempts(int maxWrtAttempts)
Sets maximum number of write attempts in case of database error.CacheJdbcPojoStoreFactory
setParallelLoadCacheMinimumThreshold(int parallelLoadCacheMinThreshold)
Parallel load cache minimum row count threshold.CacheJdbcPojoStoreFactory<K,V>
setSqlEscapeAll(boolean sqlEscapeAll)
Iftrue
all the SQL table and field names will be escaped with double quotes like ("tableName"."fieldsName"
).CacheJdbcPojoStoreFactory
setTransformer(JdbcTypesTransformer transformer)
Sets types transformer.CacheJdbcPojoStoreFactory
setTypes(JdbcType... types)
Sets store configurations.String
toString()
-
-
-
Field Detail
-
DFLT_WRITE_ATTEMPTS
public static final int DFLT_WRITE_ATTEMPTS
Default value for write attempts.- See Also:
- Constant Field Values
-
DFLT_BATCH_SIZE
public static final int DFLT_BATCH_SIZE
Default batch size for put and remove operations.- See Also:
- Constant Field Values
-
DFLT_PARALLEL_LOAD_CACHE_MINIMUM_THRESHOLD
public static final int DFLT_PARALLEL_LOAD_CACHE_MINIMUM_THRESHOLD
Default batch size for put and remove operations.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public CacheJdbcPojoStore<K,V> create()
- Specified by:
create
in interfacejavax.cache.configuration.Factory<K>
-
setDataSource
@Deprecated public CacheJdbcPojoStoreFactory<K,V> setDataSource(DataSource dataSrc)
Deprecated.Sets data source. Data source should be fully configured and ready-to-use.- Parameters:
dataSrc
- Data source.- Returns:
This
for chaining.- See Also:
CacheAbstractJdbcStore.setDataSource(DataSource)
-
getBatchSize
public int getBatchSize()
Get maximum batch size for write and delete operations.- Returns:
- Maximum batch size.
-
setBatchSize
public CacheJdbcPojoStoreFactory setBatchSize(int batchSize)
Set maximum batch size for write and delete operations.- Parameters:
batchSize
- Maximum batch size.- Returns:
This
for chaining.
-
getDataSourceBean
public String getDataSourceBean()
Gets name of the data source bean.- Returns:
- Data source bean name.
-
setDataSourceBean
public CacheJdbcPojoStoreFactory setDataSourceBean(String dataSrcBean)
Sets name of the data source bean.- Parameters:
dataSrcBean
- Data source bean name.- Returns:
This
for chaining.
-
getDialect
public JdbcDialect getDialect()
Get database dialect.- Returns:
- Database dialect.
-
setDialect
public CacheJdbcPojoStoreFactory setDialect(JdbcDialect dialect)
Set database dialect.- Parameters:
dialect
- Database dialect.- Returns:
This
for chaining.
-
getMaximumPoolSize
public int getMaximumPoolSize()
Get maximum workers thread count. These threads are responsible for queries execution.- Returns:
- Maximum workers thread count.
-
setMaximumPoolSize
public CacheJdbcPojoStoreFactory setMaximumPoolSize(int maxPoolSize)
Set Maximum workers thread count. These threads are responsible for queries execution.- Parameters:
maxPoolSize
- Max workers thread count.- Returns:
This
for chaining.
-
getMaximumWriteAttempts
public int getMaximumWriteAttempts()
Gets maximum number of write attempts in case of database error.- Returns:
- Maximum number of write attempts.
-
setMaximumWriteAttempts
public CacheJdbcPojoStoreFactory setMaximumWriteAttempts(int maxWrtAttempts)
Sets maximum number of write attempts in case of database error.- Parameters:
maxWrtAttempts
- Number of write attempts.- Returns:
This
for chaining.
-
getParallelLoadCacheMinimumThreshold
public int getParallelLoadCacheMinimumThreshold()
Parallel load cache minimum row count threshold.- Returns:
- If
0
then load sequentially.
-
setParallelLoadCacheMinimumThreshold
public CacheJdbcPojoStoreFactory setParallelLoadCacheMinimumThreshold(int parallelLoadCacheMinThreshold)
Parallel load cache minimum row count threshold.- Parameters:
parallelLoadCacheMinThreshold
- Minimum row count threshold. If0
then load sequentially.- Returns:
This
for chaining.
-
getTypes
public JdbcType[] getTypes()
Gets types known by store.- Returns:
- Types known by store.
-
setTypes
public CacheJdbcPojoStoreFactory setTypes(JdbcType... types)
Sets store configurations.- Parameters:
types
- Store should process.- Returns:
This
for chaining.
-
getHasher
public JdbcTypeHasher getHasher()
Gets hash code calculator.- Returns:
- Hash code calculator.
-
setHasher
public CacheJdbcPojoStoreFactory setHasher(JdbcTypeHasher hasher)
Sets hash code calculator.- Parameters:
hasher
- Hash code calculator.- Returns:
This
for chaining.
-
getTransformer
public JdbcTypesTransformer getTransformer()
Gets types transformer.- Returns:
- Types transformer.
-
setTransformer
public CacheJdbcPojoStoreFactory setTransformer(JdbcTypesTransformer transformer)
Sets types transformer.- Parameters:
transformer
- Types transformer.- Returns:
This
for chaining.
-
getDataSourceFactory
public javax.cache.configuration.Factory<DataSource> getDataSourceFactory()
Gets factory for underlying datasource.- Returns:
- Cache store factory.
-
setDataSourceFactory
public CacheJdbcPojoStoreFactory<K,V> setDataSourceFactory(javax.cache.configuration.Factory<DataSource> dataSrcFactory)
Sets factory for underlying datasource.- Parameters:
dataSrcFactory
- Datasource factory.- Returns:
this
for chaining.
-
isSqlEscapeAll
public boolean isSqlEscapeAll()
Iftrue
all the SQL table and field names will be escaped with double quotes like ("tableName"."fieldsName"
). This enforces case sensitivity for field names and also allows having special characters in table and field names.- Returns:
- Flag value.
-
setSqlEscapeAll
public CacheJdbcPojoStoreFactory<K,V> setSqlEscapeAll(boolean sqlEscapeAll)
Iftrue
all the SQL table and field names will be escaped with double quotes like ("tableName"."fieldsName"
). This enforces case sensitivity for field names and also allows having special characters in table and field names.- Parameters:
sqlEscapeAll
- Flag value.- Returns:
this
for chaining.
-
-