You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by dkarachentsev <dk...@gridgain.com> on 2017/02/07 14:28:29 UTC

Re: Error CacheConfig

Hi,

You need to configure indexing to use queries. For that you may use
CacheConfiguration.setIndexedTypes() or setup QueryEntity [1, 2].

For example, if you configuring cache with Integer key and String value:
CacheConfiguration<Integer, String> cfg = new
CacheConfiguration<>("cache-name");
cfg.setIndexedTypes(Integer.class, String.class);

After that you will be able to perform SQL queries on it.

For custom key/value use mentioned above annotations or QueryEntity, f.e.:

public class Key {
  @QuerySqlField
  private String key;
}

public class Value {
  @QuerySqlField
  private String value;
}

cfg.setIndexedTypes(Key.class, Value.class);

[1]
https://apacheignite.readme.io/v1.8/docs/cache-queries#section-query-configuration-by-annotations
[2]
https://apacheignite.readme.io/v1.8/docs/cache-queries#section-query-configuration-using-queryentity



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