[
https://issues.apache.org/jira/browse/IGNITE-17509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitry Pavlov updated IGNITE-17509:
-----------------------------------
Labels: (was: ise)
> [Extensions] Spring Data pageable request result contains incorrect total
> value.
> --------------------------------------------------------------------------------
>
> Key: IGNITE-17509
> URL: https://issues.apache.org/jira/browse/IGNITE-17509
> Project: Ignite
> Issue Type: Bug
> Reporter: Mikhail Petrov
> Priority: Major
> Attachments: Reproduces_incorrect_pageable_request_total_value_.patch
>
>
> Assume that Spring Data repository contains the following method
> {code:java}
> public Page<Person> findByFirstNameContaining(String val, Pageable
> pageable);
> {code}
> In this case the following checks will fail
> {code:java}
> Page<Person> res = repo.findByFirstNameContaining("person",
> PageRequest.of(2, 100));
> assertEquals(CACHE_SIZE, res.getTotalElements());
> {code}
> where 'repo' is the instance of the previously mention repository.
> The full reproduccer is attached.
> The main reason of the such behaviour is that IgniteRepositoryQuery.java:614
> does not make a separate request of the total rows count and just sets Page
> 'total' value to 0.
> See also org.springframework.data.domain.PageImpl#PageImpl(java.util.List<T>,
> org.springframework.data.domain.Pageable, long) logic to understand the how
> the final result of 'getTotalElements()' is calculated. In bref the result
> will contain the summ of the offset and cout of values in the last page.
> It seems that as a workaround, you can explicitly request the total number of
> rows with a separate query.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)