ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anil <anilk...@gmail.com>
Subject Re: Composite affinity key
Date Tue, 25 Oct 2016 11:00:36 GMT
Thanks Sergej. i was trying the same. i will test this for my usecase.



On 25 October 2016 at 14:51, Sergej Sidorov <sergius.sidorov@gmail.com>
wrote:

> Hi, Anil!
>
> What do you mean by "composite affinity key"? What problem you want to
> solve?
> If you want to use several fields as an affinity key, then you need to
> create special class and use that class in entity key class.
>
> For example:
>
> class DepartmentAffinityKey {
>         private long companyId;
>
>         private long departmentId;
>
>         // setters, getters, equals & hashCode
> }
>
> class DepartmentKey {
>         private long departmentId;
>
>         @AffinityKeyMapped
>         private DepartmentAffinityKey affinityKey;
>
>         // setters, getters, equals & hashCode
> }
>
> class PersonKey {
>         private long personId;
>
>         @AffinityKeyMapped
>         private DepartmentAffinityKey affinityKey;
>
>         // setters, getters, equals & hashCode
> }
>
> class Department {
>         private DepartmentKey key;
>         // ...
> }
>
> class Person {
>         private PersonKey key;
>         // ...
> }
>
> cache.put(department.getKey(), department);
> cache.put(person.getKey(), person);
>
>
> Thanks,
> Sergej
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Composite-affinity-key-tp8462p8464.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Mime
View raw message