我使用Spring数据JPA,当我使用@Query
来定义查询WITHOUTPageable
,它的工作原理:弹簧数据的JPA @query和分页
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);
}
不幸的是,这不适用于本机查询。你知道是否有可能实现本机查询? – vtor
如果你想写本地查询,那么你显然需要编写查询来自己做分页。 – Steve