Reputation: 9559
I am using Spring's JPA ExampleMatcher without success.
So far, I have:
ExampleMatcher matcher = ExampleMatcher.matching()
.withIgnoreNullValues()
.withMatcher("surname", match -> match.contains().ignoreCase());
Person p = new Person();
v.setSurname("Sm");
Hoping to match Person
objects whose surname
field contains the specified substring.
But I consistently get no results.
On looking up the query log, can see why: at tries to match all the other fields too.
How can I get ExampleMatcher
to ignore all other fields?
Upvotes: 2
Views: 1274
Reputation: 44932
Use .withIgnorePaths()
to ignore primitive fields in Person
.
Upvotes: 4