我使用Spring的JPA ExampleMatcher但没有成功。
到目前为止,我有:
ExampleMatcher matcher = ExampleMatcher.matching()
.withIgnoreNullValues()
.withMatcher("surname", match -> match.contains().ignoreCase());
Person p = new Person();
v.setSurname("Sm");
希望匹配其Person
字段包含指定子字符串的surname
对象。
但我一直没有结果。
查找查询日志时,可以看到原因:尝试匹配所有其他字段。
我怎样才能让ExampleMatcher
忽略所有其他领域?
使用.withIgnorePaths()
忽略Person
中的原始字段。