New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for queries returning Page and Slice #774
Comments
Mark Paluch commented We currently support only pure collection and single-object queries. Query methods returning slices and |
Dirk Luijk commented Will this be supported in a future version of Spring Data JDBC? |
kremerkp commented is there a workaround to get a filtered, pageable object based on a queried List? For Example, I got following query that provides me a list of Customers.
|
Dirk Luijk commented kremerkp: my workaround was like this, and it worked fine: interface FooRepository extends PagingAndSortingRepository<FooEntity, Long> {
List<FooEntity> findAllByBar(String bar, Pageable pageable);
Long countAllByBar(String bar);
} And then combining those 2 queries like this: List<FooEntity> fooList = repository.findAllByBar("...", pageable);
Long fooTotalCount = repository.countAllByBar("...");
Page<FooEntity> fooPage = PageableExecutionUtils.getPage(fooList, pageable, () -> fooTotalCount);
|
Dirk Luijk commented kremerkp: the mistake in your workaround is your custom query. In Spring Data JDBC 2.0 you don't need to use that, except for special queries but they won't support pageables |
kremerkp commented Thx Dirk, that helps |
Mark Paluch commented
We want to include such a feature in a future release, submitting a pull request would actually help in getting support for returning |
+1 |
We now support pagination for queries returning Slice and Page. interface PersonRepository extends PagingAndSortingRepository<Person, String> { Slice<Person> findFirstByLastname(String lastname, Pageable pageable); Page<Person> findFirstByLastname(String lastname, Pageable pageable); } Closes #774
We now support pagination for queries returning Slice and Page. interface PersonRepository extends PagingAndSortingRepository<Person, String> { Slice<Person> findFirstByLastname(String lastname, Pageable pageable); Page<Person> findFirstByLastname(String lastname, Pageable pageable); } Closes #774
hwolf opened DATAJDBC-554 and commented
I have a JDBC respository with a method
When invoking this methid I get an exception
I exspected either
Do you habe a hint how I can fix it ?
Affects: 2.0 GA (Neumann)
Reference URL: https://gitlab.com/hwolf/xx
6 votes, 8 watchers
The text was updated successfully, but these errors were encountered: