{"record":{"id":"e6a3efdf7d9bc91b","repo":"hibernate/hibernate-orm","slug":"could-not-locate-entity-mapping","errorCode":null,"errorMessage":"Could not locate entity mapping : {}","messagePattern":"Could not locate entity mapping : (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/results/internal/Builders.java","lineNumber":162,"sourceCode":"\t\treturn new DynamicResultBuilderInstantiation<>( targetJtd );\n\t}\n\n\tpublic static ResultBuilder attributeResult(\n\t\t\tString columnAlias,\n\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","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/results/internal/Builders.java#L144-L180","documentation":"Error \"Could not locate entity mapping : {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate query API is violated: Could not locate entity mapping : <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":["No entity mapping exists for the given name. Check the entity name and that the entity class is mapped/scanned."],"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"}