重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
CustomerRepository.java
成都创新互联是一家专注于网站设计制作、成都网站设计与策划设计,凤台网站建设哪家好?成都创新互联做网站,专注于网站建设10多年,网设计领域的专业建站公司;建站业务涵盖:凤台等地区。凤台做网站价格咨询:18982081108
@Query(nativeQuery = true, value = "select * from adm_sys_customer ORDER BY ?#{#pageable}", countQuery = "select count(*) from adm_sys_customer") PagefindAllByPageable(Pageable pageable);
CustomerServiceImpl.java
//调用自定义sql PagepageObjectList = customerRepos.findAllByPageable(pageService.getPageable(1, 1, null));
ORDER BY ?#{#pageable} 必须加,否则报错:
Caused by: org.springframework.data.jpa.repository.query.InvalidJpaQueryMethodException:
Cannot use native queries with dynamic sorting and/or pagination in ...
参考:https://www.cnblogs.com/jiangxiaoyaoblog/p/5635152.html