Avoiding% and _ in a SQL predicate

The following code for finding particle data in a map does not work if the searchWord contains %, ', _, etc.

StringBuilder fullQuery= new StringBuilder().
                 append("Name like \'").append(searchWord).

List<Person> persons = (List<Person>) personMap
                .values(new SqlPredicate(fullQuery));


How can I use these symbols for the actual match.


source to share

1 answer

There is no variable binding in Hazelcast SQL like Hibernate. You have to do it yourself. You may want to keep the operator in a constant and use String :: format to replace variables.



All Articles