[ 
https://issues.apache.org/jira/browse/IGNITE-22563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Didier Loiseau updated IGNITE-22563:
------------------------------------
    Affects Version/s: 2.16
          Description: 
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.

Tested with both {{ignite-spring-data-ext}} and {{ignite-spring-data-2.2-ext}} 
(on Ignite 2.15 and 2.16).

  was:
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.


> 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, 2.16
>            Reporter: Didier Loiseau
>            Priority: Major
>
> 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.
> Tested with both {{ignite-spring-data-ext}} and 
> {{ignite-spring-data-2.2-ext}} (on Ignite 2.15 and 2.16).



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

Reply via email to