Didier Loiseau created IGNITE-22563:
---------------------------------------

             Summary: Querying an IgniteRepository with Pageable.unpaged() 
throws exception
                 Key: IGNITE-22563
                 URL: https://issues.apache.org/jira/browse/IGNITE-22563
             Project: Ignite
          Issue Type: Bug
          Components: springdata
    Affects Versions: 2.15
            Reporter: Didier Loiseau


If you try to pass a {{Pageable.unpaged()}} as {{Pageable}} argument, the 
following exception is thrown:

{code}
java.lang.UnsupportedOperationException
        at org.springframework.data.domain.Unpaged.getPageSize(Unpaged.java:78)
        at 
org.apache.ignite.springdata.repository.query.IgniteQueryGenerator.addPaging(IgniteQueryGenerator.java:153)
        at 
org.apache.ignite.springdata.repository.query.IgniteRepositoryQuery.prepareQuery(IgniteRepositoryQuery.java:746)
        at 
org.apache.ignite.springdata.repository.query.IgniteRepositoryQuery.execute(IgniteRepositoryQuery.java:343)
        at 
org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
        at 
org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
        at 
org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:152)
        at 
org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241)
…
{code}

This is because the {{IgniteQueryGenerator.addPaging()} does not check 
{{pageable.isPaged()}} before trying to apply the {{LIMIT}}.

Passing an unpaged Pageable is convenient to avoid declaring two overloads of 
the same method, when your paging needs depend on the call site.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to