Search code examples
ignite

Ignite remove is failing for child object


In our product we are using Ignite ClientCache to cache objects. We are using a class object as key to store in cache. Now when I create another drive class object and store it in ClientCache cache. Here I am adding drive class object in Baseclass cache, and after I added a child class object, I have updated some of its member fields, before removable. Now when I call ClientCache.remove() on such drive class object it fails to find such key. So my question is how can I provide custom comparator, I have already tried java equals() and hashcode() function overriding, but it does not work.


Solution

  • Ignite considers two objects equal when all of the following is true:

    • Type ID is the same (same class).
    • Serialized representation (byte[]) is the same.

    Ignite does not use standard equals() and hashCode() for comparisons, because the DB engine operates on serialized data. There is no way to override this behavior.