Search code examples
gridgain

GridGain: How to add composite primary keys


In GridGain, I have to load data such that the primary key is a composite key.

Say I have

class Person{
    int id;
    int officeId;
    ...
}

Here I want to add as primary key both id and officeId. Is it possible to add a composite key in GridGain?


Solution

  • in GridGain any Object can be used as a key, just like with HashMaps. You need to make sure that you override equals(...) and hashCode() methods for the composite keys.