{"record":{"id":"e9318fdab3c68d05","repo":"quarkusio/quarkus","slug":"field-orderfield-which-was-configured-as-the-or","errorCode":null,"errorMessage":"Field ${orderField} which was configured as the order field does not exist in the entity. Offending method is ${repositoryMethodDescription}.","messagePattern":"Field (.+?) which was configured as the order field does not exist in the entity\\. Offending method is (.+?)\\.","errorType":"exception","errorClass":"UnableToParseMethodException","httpStatus":null,"severity":"error","filePath":"extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java","lineNumber":164,"sourceCode":"        if (containsLogicOperator(afterByPart, ORDER_BY)) {\n            int orderByIndex = afterByPart.indexOf(ORDER_BY);\n            if (orderByIndex + ORDER_BY.length() == afterByPart.length()) {\n                throw new UnableToParseMethodException(\n                        \"A field must by supplied after 'OrderBy' . Offending method is \" + repositoryMethodDescription + \".\");\n            }\n            String afterOrderByPart = afterByPart.substring(orderByIndex + ORDER_BY.length());\n            afterByPart = afterByPart.substring(0, orderByIndex);\n            boolean ascending = true;\n            if (afterOrderByPart.endsWith(\"Asc\")) {\n                ascending = true;\n                afterOrderByPart = afterOrderByPart.replace(\"Asc\", \"\");\n            } else if (afterOrderByPart.endsWith(\"Desc\")) {\n                ascending = false;\n                afterOrderByPart = afterOrderByPart.replace(\"Desc\", \"\");\n            }\n            String orderField = lowerFirstLetter(afterOrderByPart);\n            if (!entityContainsField(orderField)) {\n                throw new UnableToParseMethodException(\n                        \"Field \" + orderField\n                                + \" which was configured as the order field does not exist in the entity. Offending method is \"\n                                + repositoryMethodDescription + \".\");\n            }\n\n            if (ascending) {\n                sort = Sort.ascending(orderField);\n            } else {\n                sort = Sort.descending(orderField);\n            }\n        }\n\n        List<String> parts = Collections.singletonList(afterByPart); // default when no 'And' or 'Or' exists\n        boolean containsAnd = containsLogicOperator(afterByPart, \"And\");\n        boolean containsOr = containsLogicOperator(afterByPart, \"Or\");\n        String[] partsArray = parts.toArray(new String[0]);\n        //Spring supports mixing clauses 'And' and 'Or' together in method names\n        if (containsAnd && containsOr) {","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java#L146-L182","documentation":"The field name given after 'OrderBy' in the derived method name does not match any field of the entity class. The parser validates the lower-camel-cased order field against the entity's fields and throws UnableToParseMethodException if it is absent.","triggerScenarios":"Declaring e.g. findByLastnameOrderByNaemAsc (misspelled 'name'); using the DB column name instead of the Java field name (OrderByuser_name); ordering by a field that belongs to a related entity without navigating it.","commonSituations":"Renaming an entity field without updating derived query method names; confusing column names with Java property names; typos in long method names.","solutions":["Correct the method name so the OrderBy field matches a real Java field of the entity (case-sensitive after the first letter is lowercased)","If sorting by a nested property, express the path with underscores (e.g. OrderByAddress_CityAsc) or use @Query with an explicit ORDER BY","Sort at call time via Sort.by(\"name\") instead of embedding it in the method name"],"exampleFix":"// before\nList<User> findByLastnameOrderByUsrNameAsc(String lastname);\n// after (entity field is userName)\nList<User> findByLastnameOrderByUserNameAsc(String lastname);","handlingStrategy":"validation","validationCode":"// Verify the field exists on the entity before naming the method:\n// for (Field f : MyEntity.class.getDeclaredFields()) System.out.println(f.getName());","typeGuard":null,"tryCatchPattern":"try {\n    parser.parse(methodName);\n} catch (UnableToParseMethodException e) {\n    // fix the OrderBy field to match an entity property\n    throw new IllegalStateException(\"Bad sort field: \" + e.getMessage());\n}","preventionTips":["Keep method-name sort fields in sync with entity field renames (IDE rename refactoring)","Use Java property names, not SQL column names, after OrderBy","Boot the app in a test so derived queries are validated at build time"],"tags":["jpa","spring-data","derived-query","field-not-found"],"backgroundTag":"entity-field-not-resolvable","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}