hibernate/hibernate-orm · error · SemanticException
SqmQualifiedJoin predicate referred to SqmRoot [%s] other th
Error message
SqmQualifiedJoin predicate referred to SqmRoot [%s] other than the join's root [%s]
What it means
Error "SqmQualifiedJoin predicate referred to SqmRoot [%s] other than the join's root [%s]" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPredicatePathConsumer.java:73
// If the current processing query contains the root of the current join,
// then the root of the processing path must be a root of one of the parent queries
if ( fromClause != null && contains( fromClause.getRoots(), joinRoot ) ) {
// It is allowed to use correlations from the same query
if ( !( root instanceof SqmCorrelation<?, ?> ) || !contains( fromClause.getRoots(), root ) ) {
validateAsRootOnParentQueryClosure( pathRoot, root,
processingState.getParentProcessingState() );
}
return;
}
}
// If the current join is not part of the processing query, this must be a subquery in the ON clause
// in which case the path root is allowed to occur in the current processing query as root
if ( currentProcessingQuery instanceof SqmSubQuery<?> ) {
validateAsRootOnParentQueryClosure( pathRoot, root, processingState );
return;
}
throw new SemanticException(
String.format(
Locale.ROOT,
"SqmQualifiedJoin predicate referred to SqmRoot [%s] other than the join's root [%s]",
pathRoot.getNavigablePath(),
sqmJoin.getNavigablePath()
)
);
}
super.validateAsRoot( pathRoot );
}
private void validateAsRootOnParentQueryClosure(
SqmFrom<?, ?> pathRoot,
SqmRoot<?> root,
SqmCreationProcessingState processingState) {
while ( processingState != null ) {
final var processingQuery = processingState.getProcessingQuery();View on GitHub (pinned to fad1729dce)
Solutions
- Reference only attributes of the join's own root in the ON predicate.
- Move cross-root conditions to the WHERE clause.
When it happens
Trigger: A path expression of the wrong type is used in a collection predicate.
Common situations: Applying member of / is empty / includes / intersects / in-array to non-plural expressions.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/25555ae2fcc346d7.
Report an issue: GitHub.