DATAREDIS-551 - Fix pageable query execution when derived criteria is empty.

We now make sure to count records without using criteria when derived criteria is empty. This allows usage of declared query methods using `Pageable` without criteria like `findBy(Pageable page)`.

Original Pull Request: #220
This commit is contained in:
Mark Paluch
2016-09-06 17:09:17 +02:00
committed by Christoph Strobl
parent a8462c597e
commit 5aef8c3b0b
2 changed files with 25 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ import org.springframework.util.CollectionUtils;
* Redis specific {@link QueryEngine} implementation.
*
* @author Christoph Strobl
* @author Mark Paluch
* @since 1.7
*/
class RedisQueryEngine extends QueryEngine<RedisKeyValueAdapter, RedisOperationChain, Comparator<?>> {
@@ -156,6 +157,10 @@ class RedisQueryEngine extends QueryEngine<RedisKeyValueAdapter, RedisOperationC
@Override
public long count(final RedisOperationChain criteria, final Serializable keyspace) {
if(criteria == null) {
return this.getAdapter().count(keyspace);
}
return this.getAdapter().execute(new RedisCallback<Long>() {
@Override