Hi,
it is know issue [1]. Work around is adding cache key configuration to
ignite configuration:
<property name="cacheKeyConfiguration">
<list>
<bean class="cacheKeyConfiguration">
<property name="typeName" value="com.ignitetest.PersonPK"/>
<property name="AffinityKeyFieldName" value="<YOUR_FIELD_NAME>"/>
</bean>
</list>
</property>
[1] https://issues.apache.org/jira/browse/IGNITE-5505
On Thu, Aug 3, 2017 at 7:50 PM, kotamrajuyashasvi
<[email protected]> wrote:
> Hi
>
> I am running a c++ ignite client with custom object as cache key. I
> specialized the binarytype for the cache key object in c++ and added cache
> key POJO in the binary configuration to map c++ to Java POJO. I put a string
> field in the cache POJO as Affinitykeymapped using annotation. I ran a
> sample Java client first to test if different cache key objects, having same
> field which is mapped to Affinitykey get allocated to same node or not. But
> I could see that they are getting allocated to different nodes. Also I could
> see that the field in cache key POJO that I put for affinitykey was not
> getting identified. Because when I run 'Affinity.affinityKey(cachekey
> object)' method its returning the whole cache key object instead of just the
> String field that I chose as affinitykey. But when I remove the
> binaryConfiguration in ignite-config xml everything works as expected.
>
> This is the binaryConfiguration in ignite config xml that I was talking
> about.
>
> <property name="binaryConfiguration">
> <bean
> class="org.apache.ignite.configuration.BinaryConfiguration">
> <property name="compactFooter" value="false"/>
>
> <property name="idMapper">
> <bean
> class="org.apache.ignite.binary.BinaryBasicIdMapper">
> <property name="lowerCase" value="true"/>
> </bean>
> </property>
>
> <property name="nameMapper">
> <bean
> class="org.apache.ignite.binary.BinaryBasicNameMapper">
> <property name="simpleName" value="true"/>
> </bean>
> </property>
>
> <property name="classNames">
> <list>
> <value>com.ignitetest.PersonPK</value>
> </list>
> </property>
> </bean>
> </property>
>
> Also I would like to know if there is any way to get affinity data in c++
> ignite as I could not find any in c++ docs.
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Affinity-Key-field-is-not-identified-if-binary-configuration-is-used-on-cache-key-object-tp15959.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.