Hi John, To do this, you need to create a key object with the same type as you have for the table. If you don't specify KEY_TYPE in the create table script, it will be generated automatically. I would recommend to specify it for the command(just type name, if you don't have a class) and, when you need to get data using key-value API, just create a binary object of this type with these fields: https://www.gridgain.com/docs/latest/developers-guide/key-value-api/binary-objects#creating-and-modifying-binary-objects
Evgenii вт, 14 июл. 2020 г. в 07:18, John Smith <[email protected]>: > Hi, I have an SQL table > > create table if not exists my_table ( > column1 int, > column2 int, > column3 varchar(16), > PRIMARY KEY (column1, column2) > ) with "template=replicatedTpl"; > > and I'm creating my near cache as follows... > > IgniteCache<Integer, String> myCache; > > NearCacheConfiguration<Integer, String> nearConfig = new > NearCacheConfiguration<>(); > nearConfig.setNearEvictionPolicyFactory(new > LruEvictionPolicyFactory<>(1024)); > > myCache = > this.ignite.getOrCreateNearCache(SQL_PUBLIC_MY_TABLE, nearConfig) > .withExpiryPolicy(new AccessedExpiryPolicy(new Duration(TimeUnit.HOURS, > 1))); > > So if I use myCache.get()... > > 1- How do I specify the primary key if it's 2 columns? > 2- I assume the data will be put in near cache? > > > > >
