hibernate/hibernate-orm · error · FunctionArgumentException
Argument ' ' of 'id()' does not resolve to an entity type
Error message
Argument '{}' of 'id()' does not resolve to an entity type What it means
Thrown by SemanticQueryBuilder.handleIdPath when the argument path of 'id()' does not resolve to an entity or identifiable domain type. 'id()' extracts the identifier of an entity, so a non-entity argument (basic value, embeddable, plural attribute) raises a FunctionArgumentException naming the offending path.
Solutions
- Pass an entity-typed path to the id() function.
- Check the argument resolves to a mapped entity reference.
Defensive patterns
Strategy: validation
When it happens
Trigger: A runtime precondition of the Hibernate API is violated.
Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/efcad6256f069dac.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:3540
final var sqmPath = consumeDomainPath( ctx.path() );
if ( sqmPath.getReferencedPathSource().getPathType()
instanceof IdentifiableDomainType<?> identifiableType ) {
final var identifierDescriptor = identifiableType.getIdentifierDescriptor();
if ( identifierDescriptor == null ) {
// mainly for benefit of Hibernate Processor
throw new FunctionArgumentException( "Argument '" + sqmPath.getNavigablePath()
+ "' of 'id()' is a '" + identifiableType.getTypeName()
+ "' and does not have a well-defined '@Id' attribute" );
}
return sqmPath.get( identifierDescriptor.getPathName(), true );
}
else if ( sqmPath instanceof SqmAnyValuedSimplePath<?> ) {
return sqmPath.resolvePathPart( AnyKeyPart.KEY_NAME, true,
processingStateStack.getCurrent().getCreationState() );
}
else {
throw new FunctionArgumentException( "Argument '" + sqmPath.getNavigablePath()
+ "' of 'id()' does not resolve to an entity type" );
}
}
@Override
public SqmExpression<?> visitEntityVersionExpression(HqlParser.EntityVersionExpressionContext ctx) {
return visitEntityVersionReference( ctx.entityVersionReference() );
}
@Override
public SqmPath<?> visitEntityVersionReference(HqlParser.EntityVersionReferenceContext ctx) {
return handleVersionPath( consumeDomainPath( ctx.path() ) );
}
@Nonnull
private static <U> SqmPath<?> handleVersionPath(SqmPath<U> sqmPath) {
if ( sqmPath.getReferencedPathSource().getPathType()
instanceof AbstractIdentifiableType<U> identifiableType ) {View on GitHub (pinned to fad1729dce)