Thanks Stephan,

I don't want to use POJO classes if I can help it.
I want to mimic the following in my configuration file:

CREATE TABLE IF NOT EXISTS Person (
  id int,
  city_id int,
  name varchar,
  age int,
  company varchar,
  PRIMARY KEY (id, city_id)) WITH "template=partitioned,affinity_key=city_id";

Furthermore, I want to see if it is possible to define affinity over
multiple keys, for example, have the above as

CREATE TABLE IF NOT EXISTS Person (
  id int,
  city_id int,
  name varchar,
  age int,
  company varchar,
  PRIMARY KEY (id, city_id)) WITH
"template=partitioned,*affinity_key=city_id, country_id"*

*;*

I have many caches and the relationship between them imply different
set of affinity keys. All are defined within the same configuration
file.


On Mon, Jan 20, 2020 at 12:40 PM narges saleh <snarges...@gmail.com> wrote:

> Thanks Stephan,
>
> I don't want to use POJO classes if I can help it.
> I want to mimic the following in my configuration file:
>
>
> On Mon, Jan 20, 2020 at 10:30 AM Stephen Darlington <
> stephen.darling...@gridgain.com> wrote:
>
>> Details on how to configure affinity colocation can be found in the
>> documentation:
>> https://www.gridgain.com/docs/latest/developers-guide/data-modeling/affinity-collocation
>>
>>
>> In short, use the “indexedTypes” property in the XML file and the
>> @AffinityKeyMapped annotation in your POJO key,
>>
>> Regards,
>> Stephen
>>
>> On 18 Jan 2020, at 12:28, narges saleh <snarges...@gmail.com> wrote:
>>
>> Hi All,
>>
>> I understand that CacheKeyConfiguration is defined at ignite
>> configuration level. That being the case, how do you tie the affinity key
>> to a particular cache, within the XML config file?
>> The following code snippet shows how to do in java code.
>>
>>   CacheConfiguration<PersonKey, Person> personCfg = new 
>> CacheConfiguration<PersonKey, Person>("persons");
>>
>>     //configure the affinity key
>>     personCfg.setKeyConfiguration(new CacheKeyConfiguration("Person", 
>> "companyId"));
>>
>> Also, how do you define an affinity key with multiple fields, using 
>> CacheKeyConfiguration, say SSN and company id are both part of the affinity 
>> key.
>>
>> thanks.
>>
>>
>>
>>

Reply via email to