[英]Spring JPA Query by Example returns no results
我正在使用Spring的JPA ExampleMatcher,但没有成功。
到目前为止,我有:
ExampleMatcher matcher = ExampleMatcher.matching()
.withIgnoreNullValues()
.withMatcher("surname", match -> match.contains().ignoreCase());
Person p = new Person();
v.setSurname("Sm");
希望匹配其surname
字段包含指定子字符串的Person
对象。
但是我始终没有结果。
在查询日志中,可以看到原因:在尝试也匹配所有其他字段。
如何获得ExampleMatcher
忽略所有其他字段?
使用.withIgnorePaths()
忽略Person
原始字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.