{"record":{"id":"efcad6256f069dac","repo":"hibernate/hibernate-orm","slug":"argument-of-id-does-not-resolve-to-an-ent","errorCode":null,"errorMessage":"Argument '{}' of 'id()' does not resolve to an entity type","messagePattern":"Argument '(.+?)' of 'id\\(\\)' does not resolve to an entity type","errorType":"exception","errorClass":"FunctionArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":3540,"sourceCode":"\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() );\n\t}\n\n\t@Override\n\tpublic SqmPath<?> visitEntityVersionReference(HqlParser.EntityVersionReferenceContext ctx) {\n\t\treturn handleVersionPath( consumeDomainPath( ctx.path() ) );\n\t}\n\n\t@Nonnull\n\tprivate static <U> SqmPath<?> handleVersionPath(SqmPath<U> sqmPath) {\n\t\tif ( sqmPath.getReferencedPathSource().getPathType()\n\t\t\t\tinstanceof AbstractIdentifiableType<U> identifiableType ) {","sourceCodeStart":3522,"sourceCodeEnd":3558,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L3522-L3558","documentation":"Error \"Argument '{}' of 'id()' does not resolve to an entity type\" 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-typed path to the id() function.","Check the argument resolves to a mapped entity reference."],"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"}