{"record":{"id":"621431609cf71a65","repo":"hibernate/hibernate-orm","slug":"could-not-locate-attribute-mapping","errorCode":null,"errorMessage":"Could not locate attribute mapping : {}.{}","messagePattern":"Could not locate attribute mapping : (.+?)\\.(.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/results/internal/Builders.java","lineNumber":167,"sourceCode":"\t\t\tString entityName,\n\t\t\tString attributePath,\n\t\t\tSessionFactoryImplementor sessionFactory) {\n\t\tif ( attributePath.contains( \".\" ) ) {\n\t\t\tthrow new UnsupportedOperationException(\n\t\t\t\t\t\"Support for defining a NativeQuery attribute result based on a composite path is not yet implemented\"\n\t\t\t);\n\t\t}\n\n\t\tfinal MappingMetamodelImplementor mappingMetamodel = sessionFactory.getMappingMetamodel();\n\t\tfinal String fullEntityName = mappingMetamodel.getImportedName( entityName );\n\t\tfinal EntityPersister entityMapping = mappingMetamodel.findEntityDescriptor( fullEntityName );\n\t\tif ( entityMapping == null ) {\n\t\t\tthrow new IllegalArgumentException( \"Could not locate entity mapping : \" + fullEntityName );\n\t\t}\n\n\t\tfinal AttributeMapping attributeMapping = entityMapping.findAttributeMapping( attributePath );\n\t\tif ( attributeMapping == null ) {\n\t\t\tthrow new IllegalArgumentException( \"Could not locate attribute mapping : \" + fullEntityName + \".\" + attributePath );\n\t\t}\n\n\t\tif ( attributeMapping instanceof SingularAttributeMapping singularAttributeMapping ) {\n\t\t\treturn new DynamicResultBuilderAttribute( singularAttributeMapping, columnAlias, fullEntityName, attributePath );\n\t\t}\n\n\t\tthrow new IllegalArgumentException(\n\t\t\t\tString.format(\n\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\"Specified attribute mapping [%s.%s] not a basic attribute: %s\",\n\t\t\t\t\t\tfullEntityName,\n\t\t\t\t\t\tattributePath,\n\t\t\t\t\t\tattributeMapping\n\t\t\t\t)\n\t\t);\n\t}\n\n\tpublic static ResultBuilder attributeResult(","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/results/internal/Builders.java#L149-L185","documentation":"Error \"Could not locate attribute mapping : {}.{}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate query API is violated: Could not locate attribute mapping : <value>.<value>","commonSituations":"Application code or configuration calls the query API in a way that violates its documented contract; the interpolated values in the message identify the offending input.","solutions":["The attribute mapping could not be found on the entity. Verify the attribute name in the result mapping."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}