Map query with ignore case string matching condition

Skip to first unread message

Cidy Long

Sep 1, 2021, 2:04:52 AM9/1/21
to Payara Forum
I am trying to find all persons from Hazelcast IMap by given FirsName and LastName.

The name (first and last), must be case insensitive. For example, "John Dow" and "john dow" is the same person.

I tried to use Criteria build to create case insensitive without success.

Code as:

PredicateBuilder.EntryObject eo = Predicates.newPredicateBuilder().getEntryObject();
Predicate fnpredicate = eo.get("personFirstname").equal(firstName.toLowerCase(Locale.ROOT));
Predicate lnpredicate = eo.get("personLastname").equal(lastName.toLowerCase(Locale.ROOT));
Predicate personPredicate = Predicates.and(fnpredicate,lnpredicate);
Collection<Person> persons = getEntityMap().values( personPredicate );

My question is: How I can set predicate's attributes to lower case?

Rudy De Busscher

Sep 1, 2021, 2:50:54 AM9/1/21
to Payara Forum


You might have more responses on a Hazelcast forum with this question as this is not specific to Payara.

Reply all
Reply to author
0 new messages