{"record":{"id":"0db7bac4aa336313","repo":"quarkusio/quarkus","slug":"method-of-repository-repository-is-meant-to-0db7ba","errorCode":null,"errorMessage":"${method} of Repository ${repository} is meant to be a delete query and therefore doesn't support Pageable and Sort method parameters","messagePattern":"(.+?) of Repository (.+?) is meant to be a delete query and therefore doesn't support Pageable and Sort method parameters","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java","lineNumber":345,"sourceCode":"\n                        // call JpaOperations.exists()\n                        Expr exists = bc.invokeVirtual(\n                                MethodDesc.of(AbstractManagedJpaOperations.class, \"exists\", boolean.class,\n                                        Class.class, String.class, Object[].class),\n                                ops, entityClass,\n                                Const.of(parseResult.getQuery()), paramsArray);\n\n                        handleBooleanReturnValue(bc, exists, returnType.name());\n\n                    } else if (parseResult.getQueryType() == MethodNameParser.QueryType.DELETE) {\n                        if (!DotNames.PRIMITIVE_LONG.equals(returnType.name()) && !DotNames.LONG.equals(returnType.name())\n                                && !DotNames.VOID.equals(returnType.name())) {\n                            throw new IllegalArgumentException(\n                                    method.name() + \" of Repository \" + repositoryClassInfo\n                                            + \" is meant to be a delete query and can therefore only have a void or long return type\");\n                        }\n                        if ((finalSortParameterIndex != null) || finalPageableParameterIndex != null) {\n                            throw new IllegalArgumentException(\n                                    method.name() + \" of Repository \" + repositoryClassInfo\n                                            + \" is meant to be a delete query and therefore doesn't \" +\n                                            \"support Pageable and Sort method parameters\");\n                        }\n\n                        AnnotationInstance modifyingAnnotation = method.annotation(DotNames.SPRING_DATA_MODIFYING);\n                        handleFlushAutomatically(modifyingAnnotation, bc, entityClass);\n\n                        // call JpaOperations.delete()\n                        Expr delete = bc.invokeStatic(\n                                MethodDesc.of(AdditionalJpaOperations.class, \"deleteWithCascade\",\n                                        long.class, AbstractManagedJpaOperations.class, Class.class, String.class,\n                                        Object[].class),\n                                ops, entityClass,\n                                Const.of(parseResult.getQuery()), paramsArray);\n\n                        handleClearAutomatically(modifyingAnnotation, bc, entityClass);\n","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java#L327-L363","documentation":"Derived delete operations (deleteBy...) act on all matching rows at once, so Sort and Pageable parameters are meaningless for them. The spring-data-jpa extension rejects any deleteBy method declaring a Sort or Pageable parameter. The message text says 'count query' because the DELETE branch reuses the same message string — it is still thrown from the DELETE code path.","triggerScenarios":"Declaring e.g. long deleteByStatus(String status, Pageable pageable) or void deleteByExpired(boolean expired, Sort sort) — a DELETE query type with finalSortParameterIndex != null or finalPageableParameterIndex != null.","commonSituations":"Mass-adding Pageable parameters during a pagination refactor; wanting to 'delete only the first N matches' and reaching for Pageable; copy-paste from a paginated finder.","solutions":["Remove the Sort/Pageable parameter from the deleteBy method","If limited deletion is genuinely required, use @Query with JPQL delete and setMaxResults semantics via a custom method, or delete selected entities loaded via findAll(Pageable)","Keep deletion methods simple: deleteByCriteria matching all rows, returning void or long"],"exampleFix":"// before\nlong deleteByStatus(String status, Pageable pageable);\n\n// after\nlong deleteByStatus(String status);","handlingStrategy":"validation","validationCode":"// Ensure deleteBy methods take no Pageable/Sort\nfor (Method m : PersonRepository.class.getDeclaredMethods()) {\n    if (m.getName().startsWith(\"deleteBy\") && Arrays.stream(m.getParameterTypes())\n            .anyMatch(t -> Pageable.class.isAssignableFrom(t) || Sort.class.isAssignableFrom(t)))\n        throw new IllegalStateException(m.getName() + \" must not take Pageable/Sort\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deletes act on all matching rows — design APIs accordingly","For limited deletes, load entities first and remove them explicitly","Exclude mutation methods from pagination refactors"],"tags":["spring-data","jpa","quarkus","derived-query","build-time"],"backgroundTag":"unsupported-pagination-on-count-query","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}