{"record":{"id":"5f122f86308dd6cb","repo":"quarkusio/quarkus","slug":"of-repository","errorCode":null,"errorMessage":" of Repository ","messagePattern":" of Repository ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/CustomQueryMethodsAdder.java","lineNumber":267,"sourceCode":"                                deleteCount = bc.invokeVirtual(\n                                        MethodDesc.of(AbstractManagedJpaOperations.class, \"delete\", long.class,\n                                                Class.class, String.class, Object[].class),\n                                        ops, entityClass,\n                                        Const.of(deleteQueryString), paramsArray);\n                            }\n                            handleClearAutomatically(modifyingAnnotation, bc, entityClass);\n\n                            if (DotNames.VOID.equals(methodReturnTypeDotName)) {\n                                bc.return_();\n                            } else {\n                                handleLongReturnValue(bc, deleteCount, methodReturnTypeDotName);\n                            }\n\n                        } else if (finalQueryString.toLowerCase().startsWith(\"update\")) {\n                            if (!DotNames.PRIMITIVE_INTEGER.equals(methodReturnTypeDotName)\n                                    && !DotNames.INTEGER.equals(methodReturnTypeDotName)\n                                    && !DotNames.VOID.equals(methodReturnTypeDotName)) {\n                                throw new IllegalArgumentException(\n                                        method.name() + \" of Repository \" + repositoryClassInfo\n                                                + \" is meant to be an update query and can therefore only have a void or integer return type\");\n                            }\n\n                            Expr updateCount;\n                            if (!finalNamedParameterToIndex.isEmpty()) {\n                                Expr parameters = generateParametersObject(finalNamedParameterToIndex, bc, params);\n                                Expr parametersMap = bc.invokeVirtual(\n                                        MethodDesc.of(Parameters.class, \"map\", Map.class),\n                                        parameters);\n\n                                // call JpaOperations.executeUpdate\n                                updateCount = bc.invokeVirtual(\n                                        MethodDesc.of(AbstractManagedJpaOperations.class, \"executeUpdate\", int.class,\n                                                String.class, Map.class),\n                                        ops,\n                                        Const.of(finalQueryString),\n                                        parametersMap);","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/CustomQueryMethodsAdder.java#L249-L285","documentation":"A @Modifying query starting with 'update' may only return void, int, or java.lang.Integer (the affected row count). The recorded message fragment ' of Repository ' corresponds to the full IllegalArgumentException: '<method> of Repository <repo> is meant to be an update query and can therefore only have a void or integer return type'. It fails at build time because no other result shape can be produced by an update statement.","triggerScenarios":"A repository method with @Query(\"update ...\") declared to return long, Long, boolean, an entity type, List, or anything other than int/Integer/void.","commonSituations":"Using long for update counts (allowed for delete in this layer, but NOT for update); porting a method from another framework that returned the updated entity; copy-paste of a delete method signature where long was required but update requires int.","solutions":["Change the return type to int, Integer, or void","Do not use long/Long for update counts — unlike delete, update requires int here","Declare void if the count is not needed","Check the message: it names the exact method and repository whose signature must change"],"exampleFix":"// before\n@Modifying\n@Query(\"update User u set u.active = false where u.lastLogin < :d\")\nlong deactivateInactive(Instant d);\n// after\n@Modifying\n@Query(\"update User u set u.active = false where u.lastLogin < :d\")\nint deactivateInactive(Instant d);","handlingStrategy":"validation","validationCode":"if (query.trim().toLowerCase().startsWith(\"update\")) {\n    Class<?> rt = method.getReturnType();\n    if (!(rt.equals(void.class) || rt.equals(int.class) || rt.equals(Integer.class)))\n    throw new IllegalArgumentException(\"Update @Query must return void or int/Integer\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    compile();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"update query and can therefore only have\")) {\n        log.error(\"Change return type to int/Integer/void\");\n    }\n    throw e;\n}","preventionTips":["Declare update @Query methods as int, Integer, or void only","Remember: update wants int while delete wants long in this layer","Never return the modified entity from a bulk update method","Lint repository interfaces for modifying-query return types"],"tags":["spring-data-jpa","quarkus","update-query","return-type","build-time"],"backgroundTag":"update-query-return-type-restricted","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}