{"record":{"id":"f336a0221b14baf3","repo":"quarkusio/quarkus","slug":"attribute-attr-of-query-is-currently-not-suppo","errorCode":null,"errorMessage":"Attribute ${attr} of @Query is currently not supported. Offending method is ${method} of Repository ${repository}","messagePattern":"Attribute (.+?) of @Query is currently not supported\\. Offending method is (.+?) 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":425,"sourceCode":"            customClassCreatedCallback.accept(implName.toString());\n        }\n    }\n\n    private Set<String> extractNamedParameters(String queryString) {\n        Set<String> namedParameters = new LinkedHashSet<>();\n        final Matcher matcher = NAMED_PARAMETER.matcher(queryString);\n        while (matcher.find()) {\n            namedParameters.add(matcher.group(1));\n        }\n        return namedParameters;\n    }\n\n    // we currently only support the 'value' attribute of @Query\n    private void verifyQueryAnnotation(AnnotationInstance queryInstance, String methodName, String repositoryName) {\n        List<AnnotationValue> values = queryInstance.values();\n        for (AnnotationValue value : values) {\n            if (!QUERY_VALUE_FIELD.equals(value.name()) && !QUERY_COUNT_FIELD.equals(value.name())) {\n                throw new IllegalArgumentException(\"Attribute \" + value.name() + \" of @Query is currently not supported. \" +\n                        \"Offending method is \" + methodName + \" of Repository \" + repositoryName);\n            }\n        }\n        if (queryInstance.value(QUERY_VALUE_FIELD) == null) {\n            throw new IllegalArgumentException(\"'value' attribute must be specified on @Query annotation of method. \" +\n                    \"Offending method is \" + methodName + \" of Repository \" + repositoryName);\n        }\n    }\n\n    private Expr generateParamsArray(List<Integer> queryParameterIndexes, BlockCreator bc, ParamVar[] params) {\n        LocalVar paramsArray = bc.localVar(\"paramsArray\", bc.newEmptyArray(Object.class, queryParameterIndexes.size()));\n        for (int i = 0; i < queryParameterIndexes.size(); i++) {\n            bc.set(paramsArray.elem(i), params[queryParameterIndexes.get(i)]);\n        }\n        return paramsArray;\n    }\n\n    private Expr generateParametersObject(Map<String, Integer> namedParameterToIndex, BlockCreator bc, ParamVar[] params) {","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/CustomQueryMethodsAdder.java#L407-L443","documentation":"The extension only supports the 'value' (and 'countName'/'countQuery'-style value field) attributes of Spring Data's @Query annotation at build time. Any other attribute set on @Query (e.g. nativeQuery, name, countName in unsupported form) is rejected with this IllegalArgumentException during augmentation because generating the query method cannot honor it.","triggerScenarios":"Using @Query with an attribute other than 'value' (the QUERY_VALUE_FIELD) or the supported count field, e.g. @Query(value = \"...\", nativeQuery = true), verified in CustomQueryMethodsAdder.verifyQueryAnnotation.","commonSituations":"Migrating Spring Data repositories that use nativeQuery = true; copying @Query definitions with named-query attributes (name/countName) from Spring projects.","solutions":["Remove unsupported attributes from @Query, keeping only value","For native SQL, replace the native query with an equivalent JPQL query","Perform the native query outside the repository via EntityManager in a custom repository fragment","Check the extension version/docs for the currently supported @Query attribute set"],"exampleFix":"// before\n@Query(value = \"SELECT * FROM users WHERE age > :age\", nativeQuery = true)\nList<User> findOlderThan(int age);\n\n// after\n@Query(\"SELECT u FROM User u WHERE u.age > :age\")\nList<User> findOlderThan(int age);","handlingStrategy":"validation","validationCode":"// keep only 'value' (and supported count attribute) on @Query\nSet<String> allowed = Set.of(\"value\", \"countQuery\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use nativeQuery=true with the Quarkus Spring Data extension","Translate native SQL to JPQL","Check the extension docs for supported @Query attributes before migrating"],"tags":["quarkus","spring-data-jpa","build-time","query-annotation","native-query"],"backgroundTag":"unsupported-query-annotation","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"}