Hazelcast: Apply predicate to nested object array

Viewed 31

Here my stored objects into practitioner Hazelcast map

Practitioner(
  identifier=null,
  active=PrimitiveType(value=true),
  name=null,
  telecom=null,
  address=[
    Address(
      city=PrimitiveType(value=sdf),
      country=PrimitiveType(value=sdf)
    )
  ],
  gender=null
)
Practitioner(
  identifier=null,
  active=PrimitiveType(value=true),
  name=null,
  telecom=null,
  address=[
    Address(
      city=PrimitiveType(value=city1),
      country=PrimitiveType(value=country1)
    ),
    Address(
      city=PrimitiveType(value=city2),
      country=PrimitiveType(value=country2)
    )
  ],
  gender=null
)

Here my predicate

EntryObject e = Predicates.newPredicateBuilder().getEntryObject();
PredicateBuilder countryPredicate = e.get("address[any].country.value").equal("country1");
Predicate cityPredicate = e.get("address[any].city.value").equal("city2");

Collection<Practitioner> practitionersFound = this.practitioners.values( countryPredicate.and(cityPredicate) );

After that, I'm getting one practitioner value. However, I need to result is empty sice any practitioner object contains an address where address.city="city1" and same address.country="country2".

I took a look on this question. There are suggesting to use ValueExtractor, but I don't quite figure out how to get it. Any ideas?

0 Answers
Related