Map query with ignore case string matching condition

15 views
Skip to first unread message

Cidy Long

unread,
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

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

Hi,

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

Rudy
Reply all
Reply to author
Forward
0 new messages