title: Either use @Param on all parameters except Pageable and Sort typed once Spring boot
body: <p>I saw some questions about this error but I could not find a solution for my case.</p>
  
  <p>I'm implementing a paging in the spring boot application.</p>
  
  <p>I Have this method in my controller </p>
  
  <pre><code>@RequestMapping(method = RequestMethod.GET, value = "/distrito",  params = { "page", "size" })
      public ResponseEntity&lt;Page&lt;Distritos&gt;&gt; buscarTodosDistritos(HttpServletRequest request, @RequestParam("page") int page, @RequestParam("size") int size) throws ServletException { 
          Map&lt;String, String&gt;informacaoUsuario = uService.getInformacoesUsuario(request);
  
          Page&lt;Distritos&gt; distritosBuscados = distritosService.buscarFiltro(Long.parseLong(informacaoUsuario.get("idEntidadeSelecionada")), page, size);
              return new ResponseEntity&lt;&gt;(distritosBuscados, HttpStatus.OK);
      } 
  </code></pre>
  
  <p>and my service </p>
  
  <pre><code>    public Page&lt;Distritos&gt; buscarFiltro(Long usuarioEntidade ,int size, int page){
          return distritosRepository.encontrar(usuarioEntidade, size, page);
      }
  </code></pre>
  
  <p>my repository </p>
  
  <pre><code>@Query( nativeQuery=true, value="SELECT dist.nome, dist.id_distrito, dist.id_entidade, dist.id_municipio, dist.id_uf, dist.codigo_dne, dist.flag_ativo,  enti.nome Entidade, muni.nome Municipio, unfe.nome UF FROM glb.distritos  dist, glb.entidades  enti, glb.municipios muni, glb.ufs unfe WHERE dist.id_entidade  = enti.id_entidade AND dist.id_municipio = muni.id_municipio AND muni.id_uf = unfe.id_uf and enti.id_entidade = :parametroId order by nome   ")
      public  Page&lt;Distritos&gt;  encontrar(@Param ("parametroId")Long usuarioEntidade, int size, int page);
  </code></pre>
  
  <p>and i got this error</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Either use @Param on all parameters except Pageable and Sort typed once, or none at all!
      at org.springframework.util.Assert.isTrue(Assert.java:92) ~[spring-core-4.3.9.RELEASE.jar:4.3.9.RELEASE]
      at org.springframework.data.repository.query.Parameters.assertEitherAllParamAnnotatedOrNone(Parameters.java:297) ~[spring-data-commons-1.13.4.RELEASE.jar:na]
      at org.springframework.data.repository.query.Parameters.&lt;init&gt;(Parameters.java:91) ~[spring-data-commons-1.13.4.RELEASE.jar:na]
  </code></pre>
  
  <p>how can i solve that ???</p>