jpa分页查询怎么做
发布网友
发布时间:2022-04-26 00:18
我来回答
共1个回答
热心网友
时间:2023-10-23 10:12
@SuppressWarnings("unchecked")
2. public PageResult<T> getList(Integer currentPage){
3. PageResult<T> pageResult = new PageResult<T>();
4. int pageSize = Constant.DEFAULT_PAGE_SIZE;
5. int start = (currentPage - 1) * pageSize;
6. Query query = getEntityManager().createNamedQuery("ReturnTrainAppyUser");
7. int total = query.getResultList().size();
8. // 判断分页
9. if (start < total && pageSize > 0) {