Thanks Evgenii for the reply. How do I do that in XML configuration file if my query entities are defined solely in the xml file? What does ClassNameOfKey and fieldNameinThatClass represent? I assume I will have one bean for each cache. <bean class="...CacheConfiguration"> <property name="keyConfiguration"> <list> <bean class="org.apache.ignite.cache.CacheKeyConfiguration"> <property name="typeName" value="ClassNameOfKey"/> <property name="affinityKeyFieldName"
value="fieldNameInThatClass"/> </bean> </list> </property> </bean> And the bean for the query entity is:have <bean class="org.apache.ignite.cache.QueryEntity"> <property name="keyType" value="java.lang.Integer"/> <property name="valueType" value="PERSON"/> <property name="tableName" value="PERSON"/> <!-- Set fields for value object. --> <property name="fields"> <map> <entry key="CompanyId" value="java.lang.Integer"/> <entry key="EmployeeId" value="java.lang.Integer"/> <entry key="firstName" value="java.lang.String"/> <entry key="lastName" value="java.lang.String"/> </map> </property> <property name="keyFields"> <set> <!-- These are fields stored in the key. --> <value>CompanyId</value> <value>EmployeeId</value> </set> </property> </bean> On Mon, Mar 16, 2020 at 3:22 PM Evgenii Zhuravlev <e.zhuravlev...@gmail.com> wrote: > Hi, > > You should have one cache per table(query entity) and configure separate > CacheKeyConfigurations for each of the caches. > > Evgenii > > пн, 16 мар. 2020 г. в 11:42, narges saleh <snarges...@gmail.com>: > >> Hi All, >> >> I have a question that might be trivial. >> If I define my query entity for each in the XML configuration file and >> define the affinity key via CacheKeyConfiguration (again in the xml file), >> considering that here affinity key is defined at IgniteConfiguration level, >> how do I specify which cache keys (i.e., query entity key fields) will use >> the affinity key and which ones don't? >> >> Say I have these 4 tables >> Employee(company-id, employee-id) >> Contractor(company-id, contractor-id) >> Customer(company-id, customer-id) >> Company(company-id, address) >> >> How do I collocate employee, and contractors with companies but not the >> customers and companies? Can you provide the CacheKeyConfiguration and >> keyfields for each query entity? >> >> thanks. >> >