Java SpringJPA示例查询不返回任何结果
我正在使用Spring的JPA ExampleMatcher,但没有成功 到目前为止,我已经:Java SpringJPA示例查询不返回任何结果,java,spring,spring-data-jpa,Java,Spring,Spring Data Jpa,我正在使用Spring的JPA ExampleMatcher,但没有成功 到目前为止,我已经: ExampleMatcher matcher = ExampleMatcher.matching() .withIgnoreNullValues() .withMatcher("surname", match -> match.contains().ignoreCase()); Person p = new Person();
ExampleMatcher matcher = ExampleMatcher.matching()
.withIgnoreNullValues()
.withMatcher("surname", match -> match.contains().ignoreCase());
Person p = new Person();
v.setSurname("Sm");
希望匹配其姓氏
字段包含指定子字符串的Person
对象
但我一直没有得到任何结果
在查找查询日志时,可以看到为什么:at也尝试匹配所有其他字段
如何让
ExampleMatcher
忽略所有其他字段?使用.withIgnorePaths()
忽略Person
中的原始字段它可以忽略所有路径,但定义了匹配器的路径除外?匹配者列表不是常数。可能是因为您在Person
中使用了基本字段吗?看,是的,我有基本字段。我已将它们替换为原始包装器对象。成功了!