org.apache.ignite.cache.store.jdbc

## 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 for `CacheJdbcPojoStore`. Use this factory to pass `CacheJdbcPojoStore` to `CacheConfiguration`.

  Please note, that `setDataSource(DataSource)` is deprecated and `setDataSourceFactory(Factory)` or `setDataSourceBean(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 and 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 and Description
    `CacheJdbcPojoStoreFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `CacheJdbcPojoStore<K,V>` | `create()`
    `int` | `getBatchSize()` Get maximum batch size for delete 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()` If `true` all the SQL table and field names will be escaped with double quotes like ({@code "tableName"."
    `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)` If `true` all the SQL table and field names will be escaped with double quotes like ({@code "tableName"."
    `CacheJdbcPojoStoreFactory` | `setTransformer(JdbcTypesTransformer transformer)` Sets types transformer.
    `CacheJdbcPojoStoreFactory` | `setTypes(JdbcType... types)` Sets store configurations.
    `String` | `toString()`

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

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

- - ### 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

  - ### Constructor Detail

    - #### CacheJdbcPojoStoreFactory

          public CacheJdbcPojoStoreFactory()

  - ### Method Detail

    - #### create

          public CacheJdbcPojoStore<K,V> create()

      Specified by:
        `create` in interface `javax.cache.configuration.Factory<CacheAbstractJdbcStore<K,V>>`

    - #### 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 delete 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. If `0` 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()

      If `true` 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)

      If `true` 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.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020