ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Kuznetsov <akuznet...@apache.org>
Subject Re: CamelCase to lowerCase conversion of column names while loading cache from postgres .
Date Thu, 21 Mar 2019 01:18:45 GMT
Hi,

You may try to set: cacheStoreFactory.setSqlEscapeAll(true);

Hope this helps.

On Thu, Mar 21, 2019 at 1:09 AM Harshal Patil <harshal.patil@mindtickle.com>
wrote:

> Any suggestions please let me know
>
> On Wed, Mar 20, 2019, 11:45 AM Harshal Patil <harshal.patil@mindtickle.com>
> wrote:
>
>> Hi ,
>> I have enabled persistant store as Postgres .
>> This is my cacheConfiguration ,
>>
>> public static CacheConfiguration cacheIgniteTableCache() throws Exception
>> {
>>
>>     CacheConfiguration ccfg = new CacheConfiguration();
>>
>>
>>     ccfg.setName("IgniteTableCache");
>>
>>     ccfg.setCacheMode(CacheMode.*PARTITIONED*);
>>
>>     ccfg.setAtomicityMode(CacheAtomicityMode.*ATOMIC*);
>>
>>     ccfg.setCopyOnRead(true);
>>
>>
>>     CacheJdbcPojoStoreFactory cacheStoreFactory = new
>> CacheJdbcPojoStoreFactory();
>>
>>
>>     cacheStoreFactory.setDataSourceFactory(new Factory<DataSource>() {
>>
>>         */** {**@inheritDoc**} **/*
>>
>>         @Override public DataSource create() {
>>
>>             return DataSources.*INSTANCE_dsPostgreSQL_Rein*;
>>
>>         };
>>
>>     });
>>
>>
>>     cacheStoreFactory.setDialect(new BasicJdbcDialect());
>>
>>     cacheStoreFactory.setBatchSize(10000);
>>
>>
>>     cacheStoreFactory.setTypes(*jdbcTypeIgniteTable*(ccfg.getName()));
>>
>>
>>     ccfg.setCacheStoreFactory(cacheStoreFactory);
>>
>>
>>     ccfg.setReadThrough(true);
>>
>>     ccfg.setWriteThrough(true);
>>
>>
>>     ArrayList<QueryEntity> qryEntities = new ArrayList<>();
>>
>>
>>     QueryEntity qryEntity = new QueryEntity();
>>
>>
>>
>> qryEntity.setKeyType("com.gmail.patil.j.harshal.model.IgniteTableKey");
>>
>>
>> qryEntity.setValueType("com.gmail.patil.j.harshal.model.IgniteTable");
>>
>>     qryEntity.setTableName("ignite_table");
>>
>>     qryEntity.setKeyFieldName("idCol");
>>
>>
>>     HashSet<String> keyFields = new HashSet<>();
>>
>>
>>     keyFields.add("idCol");
>>
>>
>>     qryEntity.setKeyFields(keyFields);
>>
>>
>>     LinkedHashMap<String, String> fields = new LinkedHashMap<>();
>>
>>
>>     fields.put("nameCol", "java.lang.String");
>>
>>     fields.put("idCol",
>> "com.gmail.patil.j.harshal.model.IgniteTableKey");
>>
>>
>>     qryEntity.setFields(fields);
>>
>>
>>     HashMap<String, String> aliases = new HashMap<>();
>>
>>
>>     aliases.put("idCol", "idCol");
>>
>>     aliases.put("nameCol", "name_col");
>>
>>
>>     qryEntity.setAliases(aliases);
>>
>>     qryEntities.add(qryEntity);
>>
>>
>>     ccfg.setQueryEntities(qryEntities);
>>
>>
>>     return ccfg;
>>
>> }
>>
>>
>> But I am getting exception ,
>>
>> * org.postgresql.util.PSQLException: ERROR: column "idcol" does not exist*
>>
>>
>> how I can solve this ? i can see that preparedStatement don't have quotes
>> around column .
>>
>>  Current Query =  *select idCol from ignite_table *
>>
>> instead of *select "idCol" from ignite_table*
>>
>>
>>
>>
>>
>>
>>

-- 
Alexey Kuznetsov

Mime
View raw message