ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "javastuff.sam@gmail.com" <javastuff....@gmail.com>
Subject Re: Index
Date Wed, 19 Apr 2017 21:44:08 GMT
I tried REST API and H2 debug console. Do not see index, not sure what is
wrong.

I am creating cache pragmatically and can not use annotations. Below is the
sample based on CacheQueryExample.java. Removed annotations from Person.java
to create Person2.java

 
           /CacheConfiguration<Long, Person2> personCacheCfg = new
CacheConfiguration<>(PERSON_CACHE);
            personCacheCfg.setCacheMode(CacheMode.PARTITIONED);
            Collection<String> indx_fields = new ArrayList<>();
            indx_fields.add("salary");
            LinkedHashMap<String,String> fields = new LinkedHashMap<>();
            fields.put("id",Long.class.getName());
            fields.put("salary",Double.class.getName());
            QueryIndex idx = new QueryIndex();
            idx.setName("SALARY_IDX");
            idx.setFieldNames(indx_fields, true); 
            Collection<QueryIndex> idxCollection = new ArrayList<>();
            idxCollection.add(idx);
            QueryEntity ent = new QueryEntity();
            ent.setKeyType(Long.class.getName());
            ent.setValueType(Person2.class.getName());
            Collection<QueryEntity> entCollection = new ArrayList<>();
            ent.setIndexes(idxCollection);
            ent.setFields(fields);
            entCollection.add(ent);
            personCacheCfg.setQueryEntities(entCollection);
            IgniteCache<Long, Person2> personCache =
ignite.getOrCreateCache(personCacheCfg);/

With this I was expecting to see index named SALARY_IDX on column SALARY.
Can you hep identifying the issue here?

Thanks,
-Sam



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Index-tp11969p12095.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message