{"record":{"id":"e6e0cf5720f268cd","repo":"quarkusio/quarkus","slug":"ignorecase-cannot-be-specified-for-field-fieldinf","errorCode":null,"errorMessage":"IgnoreCase cannot be specified for field${fieldInfo.name()} because it is not a String type. Offending method is ${repositoryMethodDescription}.","messagePattern":"IgnoreCase cannot be specified for field(.+?) because it is not a String type\\. 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":247,"sourceCode":"                    if (relatedParentFieldInfo != null) {\n                        joinClause = \" LEFT JOIN \" + topLevelFieldName + \" \" + childEntityAlias + \" ON \"\n                                + entityAlias + \".\" + getIdFieldInfo(entityClass).name() + \" = \"\n                                + topLevelFieldName + \".\" + relatedParentFieldInfo.name() + \".\"\n                                + getIdFieldInfo(entityClass).name();\n                    } else {\n                        // Fallback for cases where the relationship is not explicit\n                        joinClause = \" LEFT JOIN \" + entityAlias + \".\" + topLevelFieldName + \" \" + childEntityAlias;\n                    }\n\n                }\n            } else {\n                // Qualify simple field references with the entity alias to avoid JPQL ambiguity\n                // when a field name matches the entity alias (e.g. field 'category' on entity 'Category')\n                fieldName = entityAlias + \".\" + fieldName;\n            }\n            validateFieldWithOperation(operation, fieldInfo, fieldName, repositoryMethodDescription);\n            if ((ignoreCase || allIgnoreCase) && !DotNames.STRING.equals(fieldInfo.type().name())) {\n                throw new UnableToParseMethodException(\n                        \"IgnoreCase cannot be specified for field\" + fieldInfo.name() + \" because it is not a String type. \"\n                                + \"Offending method is \" + repositoryMethodDescription + \".\");\n            }\n\n            if (where.length() > 0) {\n                if (containsAnd && partsArray[i - 1].equals(\"And\"))\n                    where.append(\" AND \");\n                if (containsOr && partsArray[i - 1].equals(\"Or\"))\n                    where.append(\" OR \");\n            }\n\n            String upperPrefix = (ignoreCase || allIgnoreCase) ? \"UPPER(\" : \"\";\n            String upperSuffix = (ignoreCase || allIgnoreCase) ? \")\" : \"\";\n\n            where.append(upperPrefix).append(fieldName).append(upperSuffix);\n            if ((operation == null) || \"Equals\".equals(operation) || \"Is\".equals(operation)) {\n                paramsCount++;\n                where.append(\" = \").append(upperPrefix).append(\"?\").append(paramsCount).append(upperSuffix);","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java#L229-L265","documentation":"IgnoreCase (or AllIgnoreCase) was specified in a derived query method for a field whose type is not String. Case-insensitive comparison only makes sense for textual fields, so the parser rejects it at build time with UnableToParseMethodException.","triggerScenarios":"Methods like findByAgeIgnoreCase(int age) or findAllByCreatedDateAllIgnoreCase() where the field type is Integer/Date/etc.; also triggered when a single field is marked IgnoreCase and the field's resolved type is not DotNames.STRING.","commonSituations":"Blindly appending IgnoreCase to every condition for 'safety' after migrating from a case-insensitive database; misunderstanding that IgnoreCase applies only to string comparisons.","solutions":["Remove IgnoreCase/AllIgnoreCase from non-String fields in the method name","Convert the field to String if case-insensitive matching is genuinely required","Implement manual normalization: store a lowercased column and query findByLowercasedFieldEquals(...)"],"exampleFix":"// before (age is Integer)\nList<User> findByAgeIgnoreCase(int age);\n// after\nList<User> findByAge(int age);","handlingStrategy":"validation","validationCode":"// Only append IgnoreCase when the field is String:\n// if (field.getType() == String.class) name += \"IgnoreCase\";","typeGuard":null,"tryCatchPattern":"try {\n    parser.parse(methodName);\n} catch (UnableToParseMethodException e) {\n    // drop IgnoreCase for non-String fields\n    log.error(\"IgnoreCase misuse: \" + e.getMessage());\n}","preventionTips":["Only use IgnoreCase/AllIgnoreCase on String-typed conditions","Don't blanket-append IgnoreCase to all conditions in a method name","Keep a test that exercises every derived query method"],"tags":["jpa","spring-data","derived-query","type-mismatch"],"backgroundTag":"derived-query-type-mismatch","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"}