标签:too obj sys microsoft tom ack mil tor bar
CustomerRepository.java@Query(nativeQuery = true, value = "select * from adm_sys_customer ORDER BY ?#{#pageable}", countQuery = "select count(*) from adm_sys_customer") Page<Customer> findAllByPageable(Pageable pageable);
CustomerServiceImpl.java
//调用自定义sql Page<Customer> pageObjectList = 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
标签:too obj sys microsoft tom ack mil tor bar
原文地址:http://blog.51cto.com/1385903/2058646