Hello Sarra,

Ignite considers two objects equal when both are 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.

We are not aware of any regressions right now. However, some corner case
bug is still possible.
Please attach a reproducer and we'll investigate.

Thanks,
Pavel

On Tue, Nov 30, 2021 at 5:28 PM Work <khazri.sarr...@gmail.com> wrote:

>
> Hello, I am Sarra KHAZRI a software developer located in Canada.
>
> We are currently using apache ignite 2.7.5 as a cache and we want to
> migrate to 2.11.0.
>
> The work was almost done but recently i am having problem with
> cache.replace(k,v,v) that starts to return false.
>
> We are using this method cache.replace(k,v,v) frequently in the code
> because we are working on a prediction system and data are updated.
>
> I want to understand how it works in the java doc it indicates that there
> is a comparison using equals
>
> if (cache.containsKey(key) && equals(cache.get(key), oldValue))
>  {
>     cache.put(key, newValue); return true; } else { return false;
> }
>
> Does the method cache.replace(k,v,v) compare  using equals or hashcode  if
> it equals does it use all the attributes declared in the entity or it uses
> only the attributes specified in the annotation @EqualsAndHashCode(of="id”)
> for example.
>
> All my entities are annotated with  @EqualsAndHashCode(of="id”) or
> @EqualsAndHashCode()
>
> Just a Note that when i was with 2.7.5 , in debug mode calling
> cache.replace(k,v,v)  the debugger passed through the equals method in the
> entity but not in the version 2.10 and 2.11.0.
>
> Recently I opened a post at stack overflow :
> https://stackoverflow.com/questions/70118048/ignite-2-10-0-cache-repalcek-v-v-return-false-after-upgrade-from-2-7
> .
>
> I just want to make sure that the implementation of the method
> cache.replace(k,v,v) is the same in the 2 version and there is no
> regression in the product.
>
>
> Thank you for your time and help.
>
> — Sarra
>
>

Reply via email to