Hi Denis,

This is my code:

    CacheConfiguration<Long, BinaryObject> cacheCfg =
        new CacheConfiguration<>(ORG_CACHE);

    cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cacheCfg.setBackups(1);
    cacheCfg

.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setIndexedTypes(Long.class, BinaryObject.class);

    IgniteCache<Long, BinaryObject> cache =
ignite.getOrCreateCache(cacheCfg);

    if ( UPDATE ) {
      System.out.println("Populating the cache...");

      try (IgniteDataStreamer<Long, BinaryObject> streamer =
          ignite.dataStreamer(ORG_CACHE)) {
        streamer.allowOverwrite(true);
        IgniteBinary binary = ignite.binary();
        BinaryObjectBuilder objBuilder = binary.builder(ORG_CACHE);
        ;
        for ( long i = 0; i < 100; i++ ) {
          streamer.addData(i,
              objBuilder.setField("id", i)
                  .setField("name", "organization-" + i).build());

          if ( i > 0 && i % 100 == 0 )
            System.out.println("Done: " + i);
        }
      }
    }

    IgniteCache<Long, BinaryObject> binaryCache =
        ignite.cache(ORG_CACHE).withKeepBinary();
    BinaryObject binaryPerson = binaryCache.get(54l);
    System.out.println("name " + binaryPerson.field("name"));


Not sure, If I am missing some context here , if I have to use sqlquery ,
what table name should I specify - I did not create table explicitly, do I
need to that?
How would I create the index?

Thanks,
Rajesh

On Sun, Jan 21, 2018 at 12:25 PM, Denis Magda <[email protected]> wrote:

>
>
> > On Jan 20, 2018, at 7:20 PM, Rajesh Kishore <[email protected]>
> wrote:
> >
> > Hi,
> >
> > I have requirement that my schema is not fixed , so I have to use the
> BinaryObject approach instead of fixed POJO
> >
> > I am relying on OOTB file system persistence mechanism
> >
> > My questions are:
> > - How can I specify the indexes on BinaryObject?
>
> https://apacheignite-sql.readme.io/docs/create-index
> https://apacheignite-sql.readme.io/docs/schema-and-indexes
>
> > - If I have to use sql query for retrieving objects , what table name
> should I specify, the one which is used for cache name does not work
> >
>
> Was the table and its queryable fields/indexes created with CREATE TABLE
> or Java annotations/QueryEntity?
>
> If the latter approach was taken then the table name corresponds to the
> Java type name as shown in this doc:
> https://apacheignite-sql.readme.io/docs/schema-and-indexes
>
> —
> Denis
>
> > -Rajesh
>
>

Reply via email to