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 <[email protected]> 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