You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Kartik Somani (Jira)" <ji...@apache.org> on 2020/06/08 15:29:00 UTC

[jira] [Issue Comment Deleted] (IGNITE-12702) Print warning when a cache value contains @AffinityKeyMapped annotation

     [ https://issues.apache.org/jira/browse/IGNITE-12702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kartik Somani updated IGNITE-12702:
-----------------------------------
    Comment: was deleted

(was: Pull request for this https://issues.apache.org/jira/browse/IGNITE-12702?jql=project%20%3D%20IGNITE%20AND%20labels%20in%20(newbie)%20and%20status%20%3D%20OPEN)

> Print warning when a cache value contains @AffinityKeyMapped annotation
> -----------------------------------------------------------------------
>
>                 Key: IGNITE-12702
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12702
>             Project: Ignite
>          Issue Type: Improvement
>          Components: cache
>            Reporter: Denis Mekhanikov
>            Assignee: Kartik Somani
>            Priority: Major
>              Labels: newbie
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Consider the following code snippet:
> {code:java}
> public class WrongAffinityExample {
>     public static void main(String[] args) {
>         Ignite ignite = Ignition.start("config/ignite.xml");
>         IgniteCache<EmployeeKey, EmployeeValue> cache = ignite.getOrCreateCache("employees");
>         EmployeeKey key = new EmployeeKey(1);
>         EmployeeValue value = new EmployeeValue(1, "Denis");
>         cache.put(key, value);
>     }
>     public static class EmployeeKey {
>         private int id;
>         public EmployeeKey(int id) {
>             this.id = id;
>         }
>     }
>     public static class EmployeeValue {
>         @AffinityKeyMapped
>         int departmentId;
>         String name;
>         public EmployeeValue(int departmentId, String name) {
>             this.departmentId = departmentId;
>             this.name = name;
>         }
>     }
> }
> {code}
> Note, that {{EmployeeValue}} contains an {{@AffinityKeyMapped}} annotation, which doesn't have any effect, since it's specified in a value, and not in a key.
> Such mistake is simple to make and pretty hard to track down.
>  This configuration should trigger a warning message printed in log to let the user know that this affinity key configuration is not applied.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)