Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SpringJPA示例查询不返回任何结果_Java_Spring_Spring Data Jpa - Fatal编程技术网

Java SpringJPA示例查询不返回任何结果

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();

我正在使用Spring的JPA ExampleMatcher,但没有成功

到目前为止,我已经:

    ExampleMatcher matcher = ExampleMatcher.matching()
            .withIgnoreNullValues()
            .withMatcher("surname",  match -> match.contains().ignoreCase());
    Person p = new Person();
    v.setSurname("Sm");
希望匹配其
姓氏
字段包含指定子字符串的
Person
对象

但我一直没有得到任何结果

在查找查询日志时,可以看到为什么:at也尝试匹配所有其他字段


如何让
ExampleMatcher
忽略所有其他字段?

使用
.withIgnorePaths()
忽略
Person
中的原始字段它可以忽略所有路径,但定义了匹配器的路径除外?匹配者列表不是常数。可能是因为您在
Person
中使用了基本字段吗?看,是的,我有基本字段。我已将它们替换为原始包装器对象。成功了!