{"record":{"id":"c958681d7de9fbf6","repo":"quarkusio/quarkus","slug":"field-method-does-not-exists-in-entity-class","errorCode":null,"errorMessage":"${field} method does not exists in ${entity} class.","messagePattern":"(.+?) method does not exists in (.+?) class\\.","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":479,"sourceCode":"            }\n\n            // Add static methods to convert from entity to this type\n            for (String queryMethod : queryMethods) {\n                MethodTypeDesc convertMtd = GenerationUtil.toMethodTypeDesc(implName.toString(),\n                        entityClassInfo.name().toString());\n                implClassCreator.staticMethod(\"convert_\" + queryMethod, smc -> {\n                    smc.setType(convertMtd);\n                    smc.public_();\n                    ParamVar entityParam = smc.parameter(\"entity\");\n\n                    smc.body(bc -> {\n                        LocalVar newObject = bc.localVar(\"newObject\",\n                                bc.new_(ClassDesc.of(implName.toString())));\n\n                        final List<MethodInfo> availableMethods = availableMethods(entityClassInfo, index);\n                        for (Map.Entry<String, FieldDesc> field : fields.entrySet()) {\n                            if (!getterExists(availableMethods, field.getKey())) {\n                                throw new IllegalArgumentException(field.getKey() + \" method does not exists in \"\n                                        + entityClassInfo.name().toString() + \" class.\");\n                            }\n\n                            FieldDesc f = field.getValue();\n                            Expr getterResult = bc.invokeVirtual(\n                                    ClassMethodDesc.of(ClassDesc.of(entityClassInfo.name().toString()), field.getKey(),\n                                            MethodTypeDesc.of(f.type())),\n                                    entityParam);\n                            bc.set(newObject.field(f), getterResult);\n                        }\n                        bc.return_(newObject);\n                    });\n                });\n            }\n        });\n    }\n\n    private static List<MethodInfo> availableMethods(ClassInfo entityClassInfo, IndexView index) {","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java#L461-L497","documentation":"When generating the implementation of an interface projection, the spring-data-jpa extension populates each projected property by invoking the corresponding getter on the entity. If the entity class has no getter for a projected property (getterExists fails over the entity's available methods), the generated code would be broken, so the build fails with this IllegalArgumentException naming the missing getter and the entity class.","triggerScenarios":"Declaring a projection interface with e.g. String getName(); while the entity only exposes getFullName(), or a property typed differently without its own getter (e.g. getAddress() when only getHomeAddress() exists) — any projected field whose getter name is absent from the entity's methods.","commonSituations":"Renaming an entity field/getter without updating projection interfaces; typos in the projection property name; projecting a computed/derived value that exists only in the DTO, not on the entity.","solutions":["Align the projection getter name with the entity's actual getter (e.g. rename getFullName() to match, or update the projection to getFullName())","Add the missing getter to the entity if the property genuinely exists","Remove the property from the projection interface if it has no entity counterpart","For computed values, expose them via @Query with a select expression instead of an interface projection"],"exampleFix":"// before\nclass Person { public String getFullName() { ... } }\ninterface PersonView { String getName(); }\n\n// after\nclass Person { public String getFullName() { ... } }\ninterface PersonView { String getFullName(); }","handlingStrategy":"validation","validationCode":"// Check each projection getter has a matching entity getter before building\nstatic void checkProjectionAgainstEntity(Class<?> ifc, Class<?> entity) {\n    for (Method m : ifc.getDeclaredMethods()) {\n        try {\n            entity.getMethod(m.getName());\n        } catch (NoSuchMethodException e) {\n            throw new IllegalStateException(m.getName() + \" missing on entity \" + entity.getName());\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive projection interfaces from the entity's getters (copy names verbatim)","When renaming entity fields, search all projection interfaces for the old getter name","Add a reflection-based startup/test assertion that projections match entities"],"tags":["spring-data","jpa","quarkus","projection","build-time"],"backgroundTag":"missing-entity-property","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"}