[ 
https://issues.apache.org/jira/browse/IGNITE-5505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16114470#comment-16114470
 ] 

Alexey Kukushkin commented on IGNITE-5505:
------------------------------------------

I discussed this with [~vozerov] again and confirmed we do not want to fix this 
since any fix would violate Ignite design ideology. 
To work around the problem in addition to specifying affinity key field using 
@AffinityKeyMapped annotation also specify it in the cache key configuration 
like this:

        <property name="cacheConfiguration">
            <list>
                <bean 
class="org.apache.ignite.configuration.CacheConfiguration">
                    ...
                    <property name="keyConfiguration">
                        <bean 
class="org.apache.ignite.cache.CacheKeyConfiguration">
                            <property name="typeName" value="TYPE_NAME"/>
                            <property name="affinityKeyFieldName" 
value="AFFINITY_KEY_FIELD_NAME"/>
                        </bean>
                    </property>
                </bean>
            </list>
        </property>

Resolving this issue with a fix.

> @AffinityKeyMapped annotation is ignored if class names are configured on 
> BinaryConfiguration
> ---------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-5505
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5505
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 1.7
>            Reporter: Andrey Gura
>            Assignee: Alexey Kukushkin
>             Fix For: 2.2
>
>
> {{@AffinityKeyMapped}} annotation on key class field is ignored in case when 
> class names passed to {{inaryConfiguration}} via {{setClassNames()}} method.
> The problem is that Ignite uses {{IgniteConfiguration.cacheKeyCfg}} during 
> {{BinaryContext.configure()}} execution and doesn't check class fileds on 
> {{@AffinityKeyMapped}} annotation.
> Possible solution: check class fields on {{@AffinityKeyMapped}} annotation if 
> there is no any mapping for cache key type.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to