hibernate/hibernate-orm · error · StrictJpaComplianceViolation
TUPLES
TUPLES
Error message
Strict JPA query language compliance was violated: use of tuples/row value constructors
What it means
Error "Strict JPA query language compliance was violated: use of tuples/row value constructors" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:3861
final var simplePathContext = ctx.simplePath();
final boolean quoted = simplePathContext.getStart().getType() == QUOTED_IDENTIFIER;
if ( quoted ) {
collation.append("\"");
}
collation.append( visitIdentifier( simplePathContext.identifier() ) );
for ( var pathElementContext : simplePathContext.simplePathElement() ) {
collation.append( visitIdentifier( pathElementContext.identifier() ) );
}
if ( quoted ) {
collation.append("\"");
}
return new SqmCollation( collation.toString(), null, nodeBuilder() );
}
@Override
public Object visitTupleExpression(HqlParser.TupleExpressionContext ctx) {
if ( creationOptions.useStrictJpaCompliance() ) {
throw new StrictJpaComplianceViolation(
StrictJpaComplianceViolation.Type.TUPLES
);
}
return new SqmTuple<>( visitExpressions( ctx ), nodeBuilder() );
}
private List<SqmExpression<?>> visitExpressions(ParserRuleContext parentContext) {
final int size = parentContext.getChildCount();
// Shift 1 bit instead of division by 2
final int estimateExpressionsCount = ( size >> 1 ) - 1;
final List<SqmExpression<?>> expressions = new ArrayList<>( estimateExpressionsCount );
for ( int i = 0; i < size; i++ ) {
final var parseTree = parentContext.getChild( i );
if ( parseTree instanceof HqlParser.ExpressionOrPredicateContext ) {
expressions.add( (SqmExpression<?>) parseTree.accept( this ) );
}
}
return expressions;View on GitHub (pinned to fad1729dce)
Solutions
- Tuples / row value constructors are an HQL extension not allowed under strict JPA compliance. Rewrite the comparison without row value constructors, or relax strict JPA compliance.
When it happens
Trigger: An HQL-specific construct is used while strict JPQL compliance is enabled: Strict JPA query language compliance was violated: use of tuples/row value constructors
Common situations: Applications running with hibernate.jpa.compliance.query=true (or JPA-compliance mode) that submit queries using Hibernate extensions such as collations, tuples/row value constructors, HQL collection functions (maxelement/elements/indices), value()/key() on non-Map types, or non-standard function calls without FUNCTION() syntax.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/d4fadbed29960f8d.
Report an issue: GitHub.