{"record":{"id":"96447db66e914fec","repo":"hibernate/hibernate-orm","slug":"property-propertyname-not-found-on-entit","errorCode":null,"errorMessage":"property [\" + propertyName + \"] not found on entity [\" + getEntityName() + \"]","messagePattern":"property \\[\" \\+ propertyName \\+ \"\\] not found on entity \\[\" \\+ getEntityName\\(\\) \\+ \"\\]","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java","lineNumber":617,"sourceCode":"\t\t\t}\n\t\t}\n\t\tcatch ( MappingException e ) {\n\t\t\tthrow new MappingException( \"property [\" + propertyPath + \"] not found on entity [\" + getEntityName() + \"]\" );\n\t\t}\n\n\t\treturn property;\n\t}\n\n\tprivate Property getProperty(String propertyName, List<Property> properties) throws MappingException {\n\t\tfinal String root = root( propertyName );\n\t\tfor ( var property : properties ) {\n\t\t\tif ( property.getName().equals( root )\n\t\t\t\t\t|| ( property instanceof Backref || property instanceof IndexBackref )\n\t\t\t\t\t\t\t&& property.getName().equals( propertyName ) ) {\n\t\t\t\treturn property;\n\t\t\t}\n\t\t}\n\t\tthrow new MappingException( \"property [\" + propertyName + \"] not found on entity [\" + getEntityName() + \"]\" );\n\t}\n\n\t@Override\n\tpublic Property getProperty(String propertyName) throws MappingException {\n\t\tfinal var identifierProperty = getIdentifierProperty();\n\t\tif ( identifierProperty != null\n\t\t\t\t&& identifierProperty.getName().equals( root( propertyName ) ) ) {\n\t\t\treturn identifierProperty;\n\t\t}\n\t\telse {\n\t\t\tList<Property> closure = getPropertyClosure();\n\t\t\tfinal var identifierMapper = getIdentifierMapper();\n\t\t\tif ( identifierMapper != null ) {\n\t\t\t\tclosure = new JoinedList<>( identifierMapper.getProperties(), closure );\n\t\t\t}\n\t\t\treturn getProperty( propertyName, closure );\n\t\t}\n\t}","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java#L599-L635","documentation":"Plain property lookup failure: getProperty(name, closure) scans the candidate property list for the root segment and throws when no property matches. It is the base resolver behind the public getProperty(String), used whenever mapping code needs a property by exact name on the entity or across its closure. The identifier property is checked separately by the public overload, so this usually means the requested name itself is wrong.","triggerScenarios":"Calling getProperty with a misspelled or renamed property name; looking up a property that lives on a subclass while holding the root class (or vice versa); custom integrations (filters, tuplizers, mapping tooling) resolving configured property names against the closure.","commonSituations":"Custom annotation processors or in-house mapping utilities feeding configured names into getProperty; renamed fields after refactors; hierarchy reorganization moving properties between classes.","solutions":["Print the available names from getPropertyClosure() and compare with the requested name","Fix the configured name or rename the mapping so both sides agree","For hierarchy-sensitive lookups, resolve against the class that actually declares the property"],"exampleFix":"// before\nProperty p = persistentClass.getProperty(\"emial\");\n\n// after\nProperty p = persistentClass.getProperty(\"email\");","handlingStrategy":"validation","validationCode":"Set<String> available = pc.getPropertyClosure().stream()\n        .map(Property::getName)\n        .collect(java.util.stream.Collectors.toSet());\nif (!available.contains(configuredName)) {\n    // do not call getProperty(configuredName); fix the configured name first\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate every externally configured property name against the closure names at startup","When refactoring entities, keep a list of external names that must remain stable"],"tags":["hibernate","orm","property-lookup","mapping"],"backgroundTag":"unknown-property-reference","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}