You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Kenan Dalley <ke...@gm.com> on 2016/09/14 16:48:45 UTC

Argument Type Mismatch for Oracle CLOB

I'm getting an "argument type mismatch" for my Oracle CLOB when trying to
call "loadCache".  I ran into similar situation like this before with Oracle
Timestamp when using version 1.6 of the ignite fabric and had to upgrade to
the 1.7.0 version of the ignite fabric to fix that defect.  This looks very
similar.  I have an Oracle CLOB column that I'm trying to load into a
java.lang.String field and am consistently getting the error below.  It
works if I remove the CLOB field from my JdbcType configuration, but that's
not going to work for us because most of our tables use CLOBs.

This code is just basic test code to see if the data-caching will work with
our Oracle datastore.


*-----------------------------
/EXCEPTION/
-----------------------------*
Caused by: javax.cache.integration.CacheLoaderException: Failed to set
property in POJO class [type=com.gm.ignite.HistoryResult, prop=results,
col=5, dbName=RESULTS]
	at
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore.buildPojoObject(CacheJdbcPojoStore.java:210)
	... 7 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore$ClassProperty.set(CacheJdbcPojoStore.java:397)
	at
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore$ClassProperty.access$300(CacheJdbcPojoStore.java:339)
	at
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore.buildPojoObject(CacheJdbcPojoStore.java:207)
	... 7 more

*-----------------------------
/HISTORYRESULT TABLE/
-----------------------------*
COLUMN_NAME, DATA_TYPE, NULLABLE
USER_ID, VARCHAR2(20 BYTE), No
SESSION_ID, VARCHAR2(50 BYTE), No
SESSION_TIME, DATE, Yes
SESSION_NAME, VARCHAR2(50 BYTE), No
RESULTS, CLOB, Yes
CREATED_DT, DATE, No
CREATED_BY, VARCHAR2(20 BYTE), No
MODIFIED_DT, DATE, No
MODIFIED_BY, VARCHAR2(20 BYTE), No

*-------------------------------
/HISTORYRESULTKEY CLASS/
-------------------------------*
public class HistoryResultKey {
    private String userId;
    private String sessionId;
    private String sessionName;
...

*-----------------------------
/HISTORYRESULT CLASS/
-----------------------------*
public class HistoryResult {
    private String userId;
    private String sessionId;
    private Timestamp sessionTime;
    private String sessionName;
    private String results;
    private Timestamp createdDate;
    private String createdBy;
    private Timestamp modifiedDate;
    private String modifiedBy;
...

*-----------------------------
/DEMO CLASS/
-----------------------------*
    public static void main(String[] args) throws IgniteException {
        System.out.println(">>> Start demo...");

        // Start Ignite node.
        try (Ignite ignite = Ignition.start("examples/config/example-ignite
- client-only.xml")) {
            CacheJdbcPojoStoreFactory<HistoryResultKey, HistoryResult>
pojoStoreFactory = new CacheJdbcPojoStoreFactory<>();

            pojoStoreFactory.setDataSourceFactory(new
OracleDataSourceFactory2());

            // Configure cache store.
            String cacheName = "HistoryResultCache";
            CacheConfiguration<HistoryResultKey, HistoryResult> cfg =
HistoryResultsCacheConfig
                    .cache(cacheName, pojoStoreFactory);

            try (IgniteCache<HistoryResultKey, HistoryResult> cache =
ignite.getOrCreateCache(cfg)) {

                // Preload cache from database.
                preload(cache);
...
    private static void preload(IgniteCache<HistoryResultKey, HistoryResult>
cache) {
        System.out.println();
        System.out.println(">>> Loading entries from database.");

        cache.loadCache(null, HistoryResultKey.class.getName(), "SELECT *
FROM HISTORY_RESULTS WHERE SESSION_NAME = 'name2'");
...

*-----------------------------
/JAVA CACHECONFIG/
-----------------------------*
public class HistoryResultsCacheConfig {
    private static JdbcType jdbcTypeHistoryResults(String cacheName) {
        JdbcType jdbcType = new JdbcType();

        jdbcType.setCacheName(cacheName);
        jdbcType.setDatabaseSchema("SCHEMA_A");
        jdbcType.setDatabaseTable("HISTORY_RESULTS");
        jdbcType.setKeyType("com.gm.ignite.HistoryResultKey");
        jdbcType.setValueType("com.gm.ignite.HistoryResult");

        // Key fields for HISTORY_RESULTS.
        Collection<JdbcTypeField> keys = new ArrayList<>();
        keys.add(new JdbcTypeField(Types.VARCHAR, "USER_ID", String.class,
"userId"));
        keys.add(new JdbcTypeField(Types.VARCHAR, "SESSION_ID",
String.class, "sessionId"));
        keys.add(new JdbcTypeField(Types.VARCHAR, "SESSION_NAME",
String.class, "sessionName"));
        jdbcType.setKeyFields(keys.toArray(new JdbcTypeField[keys.size()]));

        // Value fields for MATLAB_HISTORY_RESULTS.
        Collection<JdbcTypeField> vals = new ArrayList<>();
        vals.add(new JdbcTypeField(Types.VARCHAR, "USER_ID", String.class,
"userId"));
        vals.add(new JdbcTypeField(Types.VARCHAR, "SESSION_ID",
String.class, "sessionId"));
        vals.add(new JdbcTypeField(Types.TIMESTAMP, "SESSION_TIME",
Timestamp.class, "sessionTime"));
        vals.add(new JdbcTypeField(Types.VARCHAR, "SESSION_NAME",
String.class, "sessionName"));
        vals.add(new JdbcTypeField(Types.CLOB, "RESULTS", String.class,
"results"));
        vals.add(new JdbcTypeField(Types.TIMESTAMP, "CREATED_DT",
Timestamp.class, "createdDate"));
        vals.add(new JdbcTypeField(Types.VARCHAR, "CREATED_BY",
String.class, "createdBy"));
        vals.add(new JdbcTypeField(Types.TIMESTAMP, "MODIFIED_DT",
Timestamp.class, "modifiedDate"));
        vals.add(new JdbcTypeField(Types.VARCHAR, "MODIFIED_BY",
String.class, "modifiedBy"));
        jdbcType.setValueFields(vals.toArray(new
JdbcTypeField[vals.size()]));

        return jdbcType;
    }

    private static QueryEntity queryEntityHistoryResults() {
        QueryEntity qryEntity = new QueryEntity();

        qryEntity.setKeyType("com.gm.ignite.HistoryResultKey");
        qryEntity.setValueType("com.gm.ignite.HistoryResult");

        // Query fields for HISTORY_RESULTS.
        LinkedHashMap<String, String> fields = new LinkedHashMap<>();

        fields.put("userId", "java.lang.String");
        fields.put("sessionId", "java.lang.String");
        fields.put("sessionTime", "java.sql.Timestamp");
        fields.put("sessionName", "java.lang.String");
        fields.put("results", "java.lang.String");
        fields.put("createdDate", "java.sql.Timestamp");
        fields.put("createdBy", "java.lang.String");
        fields.put("modifiedDate", "java.sql.Timestamp");
        fields.put("modifiedBy", "java.lang.String");

        qryEntity.setFields(fields);

        // Aliases for fields.
        Map<String, String> aliases = new HashMap<>();

        aliases.put("userId", "USER_ID");
        aliases.put("sessionId", "SESSION_ID");
        aliases.put("sessionTime", "SESSION_TIME");
        aliases.put("sessionName", "SESSION_NAME");
        aliases.put("results", "RESULTS");
        aliases.put("createdDate", "CREATED_DT");
        aliases.put("createdBy", "CREATED_BY");
        aliases.put("modifiedDate", "MODIFIED_DT");
        aliases.put("modifiedBy", "MODIFIED_BY");

        qryEntity.setAliases(aliases);

        // Indexes for HISTORY_RESULTS.
        Collection<QueryIndex> idxs = new ArrayList<>();

        QueryIndex idx = new QueryIndex();

        idx.setName("PK_HISTORY_RESULTS_V_A_ID");

        LinkedHashMap<String, Boolean> idxFlds = new LinkedHashMap<>();

        idxFlds.put("userId", true);
        idxFlds.put("sessionId", true);
        idxFlds.put("algorithmName", true);

        idx.setFields(idxFlds);

        idxs.add(idx);

        qryEntity.setIndexes(idxs);

        return qryEntity;
    }

    public static <K, V> CacheConfiguration<K, V> cache(String cacheName,
CacheJdbcPojoStoreFactory<K, V> storeFactory) {
        if (storeFactory == null)
            throw new IllegalArgumentException("Cache store factory cannot
be null.");

        CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(cacheName);

        ccfg.setCacheStoreFactory(storeFactory);
        ccfg.setReadThrough(true);
        ccfg.setWriteThrough(true);

        // Configure JDBC types.
        Collection<JdbcType> jdbcTypes = new ArrayList<>();

        jdbcTypes.add(jdbcTypeHistoryResults(cacheName));

        storeFactory.setTypes(jdbcTypes.toArray(new
JdbcType[jdbcTypes.size()]));

        // Configure query entities.
        Collection<QueryEntity> qryEntities = new ArrayList<>();

        qryEntities.add(queryEntityHistoryResults());

        ccfg.setQueryEntities(qryEntities);

        return ccfg;
    }
}

*-----------------------------------------
/EXAMPLE-IGNITE - CLIENT-ONLY.XML/
-----------------------------------------*
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">
    
    <import resource="example-default - client-only.xml"/>

    <bean parent="ignite.cfg"/>
</beans>

*-----------------------------------------
/EXAMPLE-DEFAULT - CLIENT-ONLY.XML/
-----------------------------------------*
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd">

    
    <bean id="h2-example-db" class="org.h2.jdbcx.JdbcDataSource">
        <property name="URL" value="jdbc:h2:tcp://localhost/mem:ExampleDb"
/>
        <property name="user" value="sa" />
    </bean>

    <bean abstract="true" id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
		<property name="clientMode" value="true" />

        
        <property name="peerClassLoadingEnabled" value="true"/>

        
        <property name="includeEventTypes">
            <list>
                
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>

                
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
                <util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
            </list>
        </property>

        
        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    
                    
                    
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                
                                <value>127.0.0.1:47500..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Argument-Type-Mismatch-for-Oracle-CLOB-tp7748.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Argument Type Mismatch for Oracle CLOB

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Hi Kenan!

I prepared sample project with sample MyTransformer class.
Sample project will start in-memory H2 database server. Populate some data,
load from db and executes some queries.

See DemoStartup class.

MyTransformer works as expected.
PojoTransformerDemo.zip
<http://apache-ignite-users.70518.x6.nabble.com/file/n7792/PojoTransformerDemo.zip>  
You can import pom.xml in Idea (or other IDE) and play with project.
You may change DataSourceFactoryH2 to connect to you Oracle DB and change
MyTransformer  to handle CLOB fields.

Hope this help.





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Argument-Type-Mismatch-for-Oracle-CLOB-tp7748p7792.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Argument Type Mismatch for Oracle CLOB

Posted by Kenan Dalley <ke...@gm.com>.
Thanks, Alexey.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Argument-Type-Mismatch-for-Oracle-CLOB-tp7748p7774.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Argument Type Mismatch for Oracle CLOB

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Hi Kenan!

I will take a close look tomorrow and will share my findings.

-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Argument Type Mismatch for Oracle CLOB

Posted by Kenan Dalley <ke...@gm.com>.
I found the git IGNITE-3394 entry on the web.    However, the "type" looks to
be a Java class and doesn't really give me anything to go on for a CLOB vs a
VARCHAR2.  However, I did create a Transformer and plugged it in (or so I
thought) to try and see what came through for each field during a debugging
session.  However, my Transformer is never being called.

This is what I have.


*--------------------------------
new JdbcTypesTransformer
--------------------------------*
public class JdbcTypesClobTransformer extends JdbcTypesDefaultTransformer {

    public static final JdbcTypesClobTransformer INSTANCE = new
JdbcTypesClobTransformer();

    private JdbcTypesClobTransformer() { }

    @Override
    public Object getColumnValue(ResultSet rs, int colIdx, Class<?> type)
throws SQLException {
        System.out.println("************** INSIDE
JdbcTypesClobTransformer");
        Object val = rs.getObject(colIdx);

        if (val == null)
            return null;

        // code to check for CLOB goes here
        
        return super.getColumnValue(rs, colIdx, type);
    }
}



*--------------------------------------------------------------
changes to HistoryResultsCacheConfig cache() method
--------------------------------------------------------------*
        // existing method call
        storeFactory.setTypes(jdbcTypes.toArray(new
JdbcType[jdbcTypes.size()]));

        // new method call
        storeFactory.setTransformer(JdbcTypesClobTransformer.INSTANCE);





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Argument-Type-Mismatch-for-Oracle-CLOB-tp7748p7772.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Argument Type Mismatch for Oracle CLOB

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Hi Kenan!

JdbcTypesDefaultTransformer actually excellent example.

Take a look
https://github.com/apache/ignite/blob/ignite-1.7/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypesDefaultTransformer.java

If you have problems - post code of your transformer and I will try to help
you.

On Thu, Sep 15, 2016 at 9:17 PM, Kenan Dalley <ke...@gm.com> wrote:

> Is there an example of how this is used/done?
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Argument-Type-Mismatch-for-Oracle-CLOB-
> tp7748p7767.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com

Re: Argument Type Mismatch for Oracle CLOB

Posted by Kenan Dalley <ke...@gm.com>.
Is there an example of how this is used/done?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Argument-Type-Mismatch-for-Oracle-CLOB-tp7748p7767.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Argument Type Mismatch for Oracle CLOB

Posted by Alexey Kuznetsov <ak...@gridgain.com>.
Hi Kenan!

In ignite-1.7 we introduced JdbcTypesTransformer and its default
implementation JdbcTypesDefaultTransformer.
You need to implement MyCustomTransformer extends
JdbcTypesDefaultTransformer and handle CLOB type in your code and
delegating other types to JdbcTypesDefaultTransformer.
And after that put MyCustomTransformer to all nodes classpath and set
transformer on pojo factory.

Hope this help.

On Wed, Sep 14, 2016 at 11:48 PM, Kenan Dalley <ke...@gm.com> wrote:

> I'm getting an "argument type mismatch" for my Oracle CLOB when trying to
> call "loadCache".  I ran into similar situation like this before with
> Oracle
> Timestamp when using version 1.6 of the ignite fabric and had to upgrade to
> the 1.7.0 version of the ignite fabric to fix that defect.  This looks very
> similar.  I have an Oracle CLOB column that I'm trying to load into a
> java.lang.String field and am consistently getting the error below.  It
> works if I remove the CLOB field from my JdbcType configuration, but that's
> not going to work for us because most of our tables use CLOBs.
>
> This code is just basic test code to see if the data-caching will work with
> our Oracle datastore.
>
>
> *-----------------------------
> /EXCEPTION/
> -----------------------------*
> Caused by: javax.cache.integration.CacheLoaderException: Failed to set
> property in POJO class [type=com.gm.ignite.HistoryResult, prop=results,
> col=5, dbName=RESULTS]
>         at
> org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore.buildPojoObject(
> CacheJdbcPojoStore.java:210)
>         ... 7 more
> Caused by: java.lang.IllegalArgumentException: argument type mismatch
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
> org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore$ClassProperty.set(
> CacheJdbcPojoStore.java:397)
>         at
> org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore$
> ClassProperty.access$300(CacheJdbcPojoStore.java:339)
>         at
> org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore.buildPojoObject(
> CacheJdbcPojoStore.java:207)
>         ... 7 more
>
> *-----------------------------
> /HISTORYRESULT TABLE/
> -----------------------------*
> COLUMN_NAME, DATA_TYPE, NULLABLE
> USER_ID, VARCHAR2(20 BYTE), No
> SESSION_ID, VARCHAR2(50 BYTE), No
> SESSION_TIME, DATE, Yes
> SESSION_NAME, VARCHAR2(50 BYTE), No
> RESULTS, CLOB, Yes
> CREATED_DT, DATE, No
> CREATED_BY, VARCHAR2(20 BYTE), No
> MODIFIED_DT, DATE, No
> MODIFIED_BY, VARCHAR2(20 BYTE), No
>
> *-------------------------------
> /HISTORYRESULTKEY CLASS/
> -------------------------------*
> public class HistoryResultKey {
>     private String userId;
>     private String sessionId;
>     private String sessionName;
> ...
>
> *-----------------------------
> /HISTORYRESULT CLASS/
> -----------------------------*
> public class HistoryResult {
>     private String userId;
>     private String sessionId;
>     private Timestamp sessionTime;
>     private String sessionName;
>     private String results;
>     private Timestamp createdDate;
>     private String createdBy;
>     private Timestamp modifiedDate;
>     private String modifiedBy;
> ...
>
> *-----------------------------
> /DEMO CLASS/
> -----------------------------*
>     public static void main(String[] args) throws IgniteException {
>         System.out.println(">>> Start demo...");
>
>         // Start Ignite node.
>         try (Ignite ignite = Ignition.start("examples/
> config/example-ignite
> - client-only.xml")) {
>             CacheJdbcPojoStoreFactory<HistoryResultKey, HistoryResult>
> pojoStoreFactory = new CacheJdbcPojoStoreFactory<>();
>
>             pojoStoreFactory.setDataSourceFactory(new
> OracleDataSourceFactory2());
>
>             // Configure cache store.
>             String cacheName = "HistoryResultCache";
>             CacheConfiguration<HistoryResultKey, HistoryResult> cfg =
> HistoryResultsCacheConfig
>                     .cache(cacheName, pojoStoreFactory);
>
>             try (IgniteCache<HistoryResultKey, HistoryResult> cache =
> ignite.getOrCreateCache(cfg)) {
>
>                 // Preload cache from database.
>                 preload(cache);
> ...
>     private static void preload(IgniteCache<HistoryResultKey,
> HistoryResult>
> cache) {
>         System.out.println();
>         System.out.println(">>> Loading entries from database.");
>
>         cache.loadCache(null, HistoryResultKey.class.getName(), "SELECT *
> FROM HISTORY_RESULTS WHERE SESSION_NAME = 'name2'");
> ...
>
> *-----------------------------
> /JAVA CACHECONFIG/
> -----------------------------*
> public class HistoryResultsCacheConfig {
>     private static JdbcType jdbcTypeHistoryResults(String cacheName) {
>         JdbcType jdbcType = new JdbcType();
>
>         jdbcType.setCacheName(cacheName);
>         jdbcType.setDatabaseSchema("SCHEMA_A");
>         jdbcType.setDatabaseTable("HISTORY_RESULTS");
>         jdbcType.setKeyType("com.gm.ignite.HistoryResultKey");
>         jdbcType.setValueType("com.gm.ignite.HistoryResult");
>
>         // Key fields for HISTORY_RESULTS.
>         Collection<JdbcTypeField> keys = new ArrayList<>();
>         keys.add(new JdbcTypeField(Types.VARCHAR, "USER_ID", String.class,
> "userId"));
>         keys.add(new JdbcTypeField(Types.VARCHAR, "SESSION_ID",
> String.class, "sessionId"));
>         keys.add(new JdbcTypeField(Types.VARCHAR, "SESSION_NAME",
> String.class, "sessionName"));
>         jdbcType.setKeyFields(keys.toArray(new
> JdbcTypeField[keys.size()]));
>
>         // Value fields for MATLAB_HISTORY_RESULTS.
>         Collection<JdbcTypeField> vals = new ArrayList<>();
>         vals.add(new JdbcTypeField(Types.VARCHAR, "USER_ID", String.class,
> "userId"));
>         vals.add(new JdbcTypeField(Types.VARCHAR, "SESSION_ID",
> String.class, "sessionId"));
>         vals.add(new JdbcTypeField(Types.TIMESTAMP, "SESSION_TIME",
> Timestamp.class, "sessionTime"));
>         vals.add(new JdbcTypeField(Types.VARCHAR, "SESSION_NAME",
> String.class, "sessionName"));
>         vals.add(new JdbcTypeField(Types.CLOB, "RESULTS", String.class,
> "results"));
>         vals.add(new JdbcTypeField(Types.TIMESTAMP, "CREATED_DT",
> Timestamp.class, "createdDate"));
>         vals.add(new JdbcTypeField(Types.VARCHAR, "CREATED_BY",
> String.class, "createdBy"));
>         vals.add(new JdbcTypeField(Types.TIMESTAMP, "MODIFIED_DT",
> Timestamp.class, "modifiedDate"));
>         vals.add(new JdbcTypeField(Types.VARCHAR, "MODIFIED_BY",
> String.class, "modifiedBy"));
>         jdbcType.setValueFields(vals.toArray(new
> JdbcTypeField[vals.size()]));
>
>         return jdbcType;
>     }
>
>     private static QueryEntity queryEntityHistoryResults() {
>         QueryEntity qryEntity = new QueryEntity();
>
>         qryEntity.setKeyType("com.gm.ignite.HistoryResultKey");
>         qryEntity.setValueType("com.gm.ignite.HistoryResult");
>
>         // Query fields for HISTORY_RESULTS.
>         LinkedHashMap<String, String> fields = new LinkedHashMap<>();
>
>         fields.put("userId", "java.lang.String");
>         fields.put("sessionId", "java.lang.String");
>         fields.put("sessionTime", "java.sql.Timestamp");
>         fields.put("sessionName", "java.lang.String");
>         fields.put("results", "java.lang.String");
>         fields.put("createdDate", "java.sql.Timestamp");
>         fields.put("createdBy", "java.lang.String");
>         fields.put("modifiedDate", "java.sql.Timestamp");
>         fields.put("modifiedBy", "java.lang.String");
>
>         qryEntity.setFields(fields);
>
>         // Aliases for fields.
>         Map<String, String> aliases = new HashMap<>();
>
>         aliases.put("userId", "USER_ID");
>         aliases.put("sessionId", "SESSION_ID");
>         aliases.put("sessionTime", "SESSION_TIME");
>         aliases.put("sessionName", "SESSION_NAME");
>         aliases.put("results", "RESULTS");
>         aliases.put("createdDate", "CREATED_DT");
>         aliases.put("createdBy", "CREATED_BY");
>         aliases.put("modifiedDate", "MODIFIED_DT");
>         aliases.put("modifiedBy", "MODIFIED_BY");
>
>         qryEntity.setAliases(aliases);
>
>         // Indexes for HISTORY_RESULTS.
>         Collection<QueryIndex> idxs = new ArrayList<>();
>
>         QueryIndex idx = new QueryIndex();
>
>         idx.setName("PK_HISTORY_RESULTS_V_A_ID");
>
>         LinkedHashMap<String, Boolean> idxFlds = new LinkedHashMap<>();
>
>         idxFlds.put("userId", true);
>         idxFlds.put("sessionId", true);
>         idxFlds.put("algorithmName", true);
>
>         idx.setFields(idxFlds);
>
>         idxs.add(idx);
>
>         qryEntity.setIndexes(idxs);
>
>         return qryEntity;
>     }
>
>     public static <K, V> CacheConfiguration<K, V> cache(String cacheName,
> CacheJdbcPojoStoreFactory<K, V> storeFactory) {
>         if (storeFactory == null)
>             throw new IllegalArgumentException("Cache store factory cannot
> be null.");
>
>         CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(
> cacheName);
>
>         ccfg.setCacheStoreFactory(storeFactory);
>         ccfg.setReadThrough(true);
>         ccfg.setWriteThrough(true);
>
>         // Configure JDBC types.
>         Collection<JdbcType> jdbcTypes = new ArrayList<>();
>
>         jdbcTypes.add(jdbcTypeHistoryResults(cacheName));
>
>         storeFactory.setTypes(jdbcTypes.toArray(new
> JdbcType[jdbcTypes.size()]));
>
>         // Configure query entities.
>         Collection<QueryEntity> qryEntities = new ArrayList<>();
>
>         qryEntities.add(queryEntityHistoryResults());
>
>         ccfg.setQueryEntities(qryEntities);
>
>         return ccfg;
>     }
> }
>
> *-----------------------------------------
> /EXAMPLE-IGNITE - CLIENT-ONLY.XML/
> -----------------------------------------*
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd">
>
>     <import resource="example-default - client-only.xml"/>
>
>     <bean parent="ignite.cfg"/>
> </beans>
>
> *-----------------------------------------
> /EXAMPLE-DEFAULT - CLIENT-ONLY.XML/
> -----------------------------------------*
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:util="http://www.springframework.org/schema/util"
>        xsi:schemaLocation="
>         http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd
>         http://www.springframework.org/schema/util
>         http://www.springframework.org/schema/util/spring-util.xsd">
>
>
>     <bean id="h2-example-db" class="org.h2.jdbcx.JdbcDataSource">
>         <property name="URL" value="jdbc:h2:tcp://localhost/mem:ExampleDb"
> />
>         <property name="user" value="sa" />
>     </bean>
>
>     <bean abstract="true" id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>                 <property name="clientMode" value="true" />
>
>
>         <property name="peerClassLoadingEnabled" value="true"/>
>
>
>         <property name="includeEventTypes">
>             <list>
>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_
> TASK_SESSION_ATTR_SET"/>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
>
>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
>                 <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_
> CACHE_OBJECT_REMOVED"/>
>             </list>
>         </property>
>
>
>         <property name="discoverySpi">
>             <bean
> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>                 <property name="ipFinder">
>
>
>
>                     <bean
> class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.
> TcpDiscoveryMulticastIpFinder">
>                         <property name="addresses">
>                             <list>
>
>                                 <value>127.0.0.1:47500..47509</value>
>                             </list>
>                         </property>
>                     </bean>
>                 </property>
>             </bean>
>         </property>
>     </bean>
> </beans>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Argument-Type-Mismatch-for-Oracle-CLOB-tp7748.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Alexey Kuznetsov
GridGain Systems
www.gridgain.com