Re: JDBC store Date deserialization problem

2017-10-17 Thread franck102
Thanks Vasiliy, the transformer indeed still works fine.

I wasn't properly installed in the 2.2.0 test I used, my mistake.

Franck



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: JDBC store Date deserialization problem

2017-10-17 Thread Vasiliy Sisko
Hello @franck102
I create my simple transformer class and configure it to store in your
example.
With transformer your loadItem test is completed successfully.

My transformer class is:

package org.apache.ignite.sample;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ignite.cache.store.jdbc.JdbcTypesDefaultTransformer;
public class MyTransformer extends JdbcTypesDefaultTransformer {
   @Override public Object getColumnValue(ResultSet rs, int colIdx,
Class type) throws SQLException {
   if (type == java.util.Date.class)
   return new java.util.Date(rs.getDate(colIdx).getTime());
   return super.getColumnValue(rs, colIdx, type);
   }
}

and configuration file:


   
   
   
   
...

If you already have any problem please attach stack trace and fix your demo
application to reproduce it.

On Tue, Aug 22, 2017 at 12:40 PM, franck102  wrote:

> Thanks Val!
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/JDBC-store-Date-deserialization-
> problem-tp16276p16355.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vasiliy Sisko
GridGain Systems
www.gridgain.com


Re: JDBC store Date deserialization problem

2017-10-16 Thread franck102
My bad, the issue is not resolved but my transformer workaround was not
properly installed.

Franck



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: JDBC store Date deserialization problem

2017-10-16 Thread franck102
Hi Val,

Was this fixed in 2.2.0? It looks like my workaround doesn't work anymore
with that version...

SQL_TYPES now includes java.util.Date, however the type of my binary field
is ignored when serializing by the (very strange...) implementation of
org.apache.ignite.internal.binary.builder.BinaryValueWithType:
coming out of the store I have a nice instance with { val=;
type=11 }, and the writeTo method ignores the type field and lets the
context serialize the field (ctx.writeValue).

The context uses the Map below, which is missing java.util.Date :(





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: JDBC store Date deserialization problem

2017-08-21 Thread franck102
Thanks Val!



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/JDBC-store-Date-deserialization-problem-tp16276p16355.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: JDBC store Date deserialization problem

2017-08-21 Thread vkulichenko
Franck,

This looks like a bug, I will create tickets.

For now your workaround looks like the best way to solve the issue. Create
your own transformer that will convert java.sql.Date to java.util.Date, this
will fix the issue.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/JDBC-store-Date-deserialization-problem-tp16276p16350.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: JDBC store Date deserialization problem

2017-08-21 Thread franck102
BTW, if I remember correctly the server write -2 as a type ID because
java.util.Date is not in this array:

org.apache.ignite.internal.processors.query.QueryUtils#SQL_TYPES

If I use java.sql.Date in the Ignite configuration I get a different
exception (Wrong value has been set).

Franck



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/JDBC-store-Date-deserialization-problem-tp16276p16331.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: JDBC store Date deserialization problem

2017-08-21 Thread franck102
at
org.apache.ignite.internal.util.future.GridFutureAdapter.onDone(GridFutureAdapter.java:450)
at
org.apache.ignite.internal.processors.closure.GridClosureProcessor$2.body(GridClosureProcessor.java:959)
at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)






--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/JDBC-store-Date-deserialization-problem-tp16276p16329.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: JDBC store Date deserialization problem

2017-08-18 Thread vkulichenko
Hi Franck,

Can you attach your configuration and model classes if you have any? I'm
looking at the code and don't see how what you describe can happen. Date is
always written with type flag value 11.

As for store on the client, this is actually a requirement for transactional
caches which update the store from the node that runs transaction. For
atomic caches there is no such requirement, but internal mechanisms work in
the same way. You will have to deploy store implementation everywhere.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/JDBC-store-Date-deserialization-problem-tp16276p16301.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: JDBC store Date deserialization problem

2017-08-18 Thread franck102
:1535)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
at
org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:121)
... 10 common frames omitted



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/JDBC-store-Date-deserialization-problem-tp16276p16277.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


JDBC store Date deserialization problem

2017-08-18 Thread franck102
Hi all,

I am using a JDBC store with storeKeepBinary enabled, and getting a single
value that has a SQL date column. The JdbcTypeField for that column has
javaFieldType == java.util.Date.

The  JdbcTypesDefaultTransformer however return java.sql.Date as a value for
the field:



As a result the BinaryObjectBuilder writes that field using the optimized
marshaller (type id -2); and on the client side deserialization fails
because the readers expects typeId=11 for that field (java.util.Date).

I can't use java.sql.Date in my Pojo (it is used in other non-SQL stores)...
shouldn't the transformer be improved to create a java.util.Date value?

Thanks,
Franck



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/JDBC-store-Date-deserialization-problem-tp16276.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.