0

I am trying to add an entrylistener to my hazelcast map using a predicate to filter the entries.

The method I am calling is:

String addEntryListener(MapListener listener,
Predicate<K,V> predicate,
boolean includeValue)

I am trying to build a predicate to filter by my key. My keys are of type HazelKey which have the fields:

KeyOne keyOne;
KeyTwo keyTwo;
KeyThree keyThree;

Then these three Keys have the field:

String code

Therefore i am trying to do something along the lines of:

PredicateBuilder predicate = EntryObject.key().get("keyOne").get("code").equal("1234");

to build a predicate to filter all the entries with the keyOne value 1234.

However once the listener has been added, the entries get updated, hazelcast throws the error:

Caused by: com.hazelcast.query.QueryException: java.lang.IllegalArgumentException: There is no suitable accessor for 'code' on class 'class com.sun.proxy.$Proxy45'

I believe this is because the predicateBuilder is just ignoring the top level 'KeyOne' paramater and just using 'code' so my question is: How do I do this multilevel predicatebuilding?

Thanks in advance.

Angel Cuenca
  • 1,637
  • 6
  • 24
  • 46
D. Hill
  • 93
  • 1
  • 10

1 Answers1

0

I am not too familiar with PredicateBuilder, but I believe this should work for you:

import static com.hazelcast.query.Predicates.equal; [...] Predicate p = equal("keyOne.code", 1234);

Jaromir Hamala
  • 1,761
  • 1
  • 10
  • 13