{"record":{"id":"0fa53629f5b40174","repo":"hibernate/hibernate-orm","slug":"argument-of-id-is-a-and-does-not-hav","errorCode":null,"errorMessage":"Argument '{}' of 'id()' is a '{}' and does not have a well-defined '@Id' attribute","messagePattern":"Argument '(.+?)' of 'id\\(\\)' is a '(.+?)' and does not have a well-defined '@Id' attribute","errorType":"exception","errorClass":"FunctionArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":3529,"sourceCode":"\n\t@Override\n\tpublic SqmExpression<?> visitEntityIdExpression(HqlParser.EntityIdExpressionContext ctx) {\n\t\treturn visitEntityIdReference( ctx.entityIdReference() );\n\t}\n\n\t@Override\n\tpublic SqmPath<?> visitEntityIdReference(HqlParser.EntityIdReferenceContext ctx) {\n\t\tif ( ctx.pathContinuation() != null ) {\n\t\t\tthrow new UnsupportedOperationException( \"Path continuation from 'id()' reference not yet implemented\" );\n\t\t}\n\n\t\tfinal var sqmPath = consumeDomainPath( ctx.path() );\n\t\tif ( sqmPath.getReferencedPathSource().getPathType()\n\t\t\t\tinstanceof IdentifiableDomainType<?> identifiableType ) {\n\t\t\tfinal var identifierDescriptor = identifiableType.getIdentifierDescriptor();\n\t\t\tif ( identifierDescriptor == null ) {\n\t\t\t\t// mainly for benefit of Hibernate Processor\n\t\t\t\tthrow new FunctionArgumentException( \"Argument '\" + sqmPath.getNavigablePath()\n\t\t\t\t\t\t+ \"' of 'id()' is a '\" + identifiableType.getTypeName()\n\t\t\t\t\t\t+ \"' and does not have a well-defined '@Id' attribute\" );\n\t\t\t}\n\t\t\treturn sqmPath.get( identifierDescriptor.getPathName(), true );\n\t\t}\n\t\telse if ( sqmPath instanceof SqmAnyValuedSimplePath<?> ) {\n\t\t\treturn sqmPath.resolvePathPart( AnyKeyPart.KEY_NAME, true,\n\t\t\t\t\tprocessingStateStack.getCurrent().getCreationState() );\n\t\t}\n\t\telse {\n\t\t\tthrow new FunctionArgumentException( \"Argument '\" + sqmPath.getNavigablePath()\n\t\t\t\t\t+ \"' of 'id()' does not resolve to an entity type\" );\n\t\t}\n\t}\n\n\t@Override\n\tpublic SqmExpression<?> visitEntityVersionExpression(HqlParser.EntityVersionExpressionContext ctx) {\n\t\treturn visitEntityVersionReference( ctx.entityVersionReference() );","sourceCodeStart":3511,"sourceCodeEnd":3547,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L3511-L3547","documentation":"Error \"Argument '{}' of 'id()' is a '{}' and does not have a well-defined '@Id' attribute\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Pass an entity with a well-defined single @Id attribute to id().","Use the explicit id path (e.g. e.id) instead of the id() function."],"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"}