ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Setrakyan <dsetrak...@apache.org>
Subject Re: Custom transformer for CacheJdbcPojoStore
Date Fri, 01 Jul 2016 02:54:39 GMT

On Thu, Jun 30, 2016 at 2:15 AM, Alexey Kuznetsov <akuznetsov@gridgain.com>

> Igniters!
> We already have several cases when underlying database return something
> that CacheJdbcPojoStore failed to transform to expected java types, for
> example
> we have two issues with Oracle Date and Timestamp.
> All logic is encoded in  method:
> "o.a.i.cache.store.jdbc.CacheAbstractJdbcStore.getColumnValue(ResultSet rs,
> int colIdx, Class<?> type)".
> This method contains some simple code that convert object received from
> database to expected java class.
> And we cannot handle vendor specific classes (for example
> oracle.sql.TIMESTAMP) because ignite-core module cannot depends on vendor
> JDBC drivers.

Hm… Why don’t you use reflection to handle such types? If the driver is
there, then load the class, otherwise don’t?

> But user could write its own transformer and put it in class path and set
> on CacheJdbcPojoStore configuration.
> I'm thinking on introducing base class JdbcTypesTransformer with method
> "Object transform(ResultSet rs, int colIdx, Class<?> type)" and move all
> current logic there.

Agree. How will the transformer be specified in configuration?

> And it will be default transformer on JDBC POJO store.
> And in case if one will face issue when default transformer failed to
> transform value returned from database he will need to write a custom class
> and put it into node classpath and set on JDBC POJO store configuration.
> Any suggestions are welcome.
> --
> Alexey Kuznetsov

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message