Let named native query produce Page<Entity> as a return of query method. [DATAJPA-892]

Open
#1,249 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 30, 2020.

Assessment

This issue has not been assessed yet.

Description

in: core type: enhancement

Pramoth Suwanpech opened DATAJPA-892 and commented

I would be nice if we can do paging with native query.
If developer prepare findQuery (spring data predefined parameter {startRow:endRow}) and countQuery then it is possible to build Page?
public Page<MyEntity> findAllMyEntity(Pageable);

in native query I prepare named query as 'MyEntity.findAllMyEntity' and 'MyEntity.findAllMyEntity.count'
like this

MyEntity.findAllMyEntity

select z,b,c from MY_ENTITY LIMIT ?1,?2 -- so ?1 is startRow and ?2 is endRow

MyEntity.findAllMyEntity.count

select count(z) from MY_ENTITY LIMIT

What do you think?


No further details from DATAJPA-892

Dominant language
Java
Stars
3.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from spring-projects/spring-data-jpa

All issues in spring-projects/spring-data-jpa

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.