Rick,

This code is not compilable, because you are trying to access a non-static
class from static method.

You should make OneFeature class *static* to let it be referenced from
static context.
Its declaration should be as follows: *public static class OneFeature*

Denis

вт, 3 апр. 2018 г. в 13:01, <[email protected]>:

> Dear all,
>
>
>
> I would like to put data(key, obj/table) into one cache, as
>
>
>
> *public* *class* WriteTable {
>
> *public* *class* OneFeature {
>
>  @QuerySqlField (index = *true*)
>
> /** Field will NOT be accessible from DML statements. */
>
> *private* *final* String test;
>
> *public* OneFeature(String test) {
>
>       *this*.test = test;
>
>     }
>
> }
>
> *public* *static* *void* main(String[] args) {
>
> *int* datasize = 1000;
>
> IgniteConfiguration cfg  = *new* IgniteConfiguration();
>
> cfg.setClientMode(*false*);  //server
>
>     Ignite igniteNode = Ignition.*getOrStart*(cfg);
>
> *CacheConfiguration* cacheConf = *new* *CacheConfiguration*();
>
>     cacheConf.setName("igniteCachePut");
>
>     *cacheConf**.setIndexedTypes(String.**class**, OneFeature.**class**)*;
>
> IgniteCache<String, OneFeature> cacheKeyvalue = *igniteNode*
> *.getOrCreateCache(**cacheConf**)*;
>
>     *for* (*int* i = 1; i <= datasize; i++) {
>
>         cacheKeyvalue.put(Integer.*toString*(i), *new**
> OneFeature(Integer.toString(**i**))*);
>
>     }
>
> }
>
>
>
> Does anyone knows how to use “put/putAll” add (key, obj/table) into cache?
>
>
>
> Thanks
>
>
>
> Rick
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> 本信件可能包含工研院機密資訊,非指定之收件者,請勿使用或揭露本信件內容,並請銷毀此信件。 This email may contain
> confidential information. Please do not use or disclose it in any way and
> delete it if you are not the intended recipient.
>

Reply via email to