我使用的是 Spring Data JPA,当我使用 @Query
来定义一个查询 (没有电子邮件) Pageable
时,它可以工作:
public interface UrnMappingRepository extends JpaRepository<UrnMapping, Long> {
@Query(value = "select * from internal_uddi where urn like %?1% or contact like %?1%",
nativeQuery = true)
List<UrnMapping> fullTextSearch(String text);
}
但是如果我添加第二个参数 Pageable
,那么 @Query
将不起作用,Spring 将解析方法的名称,然后抛出 例外 No property full found
。这是窃听器吗?
public interface UrnMappingRepository extends JpaRepository<UrnMapping, Long> {
@Query(value = "select * from internal_uddi where urn like %?1% or contact like %?1%",
nativeQuery = true)
Page<UrnMapping> fullTextSearch(String text, Pageable pageable);
}