{"record":{"id":"d4fadbed29960f8d","repo":"hibernate/hibernate-orm","slug":"tuples","errorCode":"TUPLES","errorMessage":"Strict JPA query language compliance was violated: use of tuples/row value constructors","messagePattern":"Strict JPA query language compliance was violated: use of tuples/row value constructors","errorType":"exception","errorClass":"StrictJpaComplianceViolation","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":3861,"sourceCode":"\t\tfinal var simplePathContext = ctx.simplePath();\n\t\tfinal boolean quoted = simplePathContext.getStart().getType() == QUOTED_IDENTIFIER;\n\t\tif ( quoted ) {\n\t\t\tcollation.append(\"\\\"\");\n\t\t}\n\t\tcollation.append( visitIdentifier( simplePathContext.identifier() ) );\n\t\tfor ( var pathElementContext : simplePathContext.simplePathElement() ) {\n\t\t\tcollation.append( visitIdentifier( pathElementContext.identifier() ) );\n\t\t}\n\t\tif ( quoted ) {\n\t\t\tcollation.append(\"\\\"\");\n\t\t}\n\t\treturn new SqmCollation( collation.toString(), null, nodeBuilder() );\n\t}\n\n\t@Override\n\tpublic Object visitTupleExpression(HqlParser.TupleExpressionContext ctx) {\n\t\tif ( creationOptions.useStrictJpaCompliance() ) {\n\t\t\tthrow new StrictJpaComplianceViolation(\n\t\t\t\t\tStrictJpaComplianceViolation.Type.TUPLES\n\t\t\t);\n\t\t}\n\t\treturn new SqmTuple<>( visitExpressions( ctx ), nodeBuilder() );\n\t}\n\n\tprivate List<SqmExpression<?>> visitExpressions(ParserRuleContext parentContext) {\n\t\tfinal int size = parentContext.getChildCount();\n\t\t// Shift 1 bit instead of division by 2\n\t\tfinal int estimateExpressionsCount = ( size >> 1 ) - 1;\n\t\tfinal List<SqmExpression<?>> expressions = new ArrayList<>( estimateExpressionsCount );\n\t\tfor ( int i = 0; i < size; i++ ) {\n\t\t\tfinal var parseTree = parentContext.getChild( i );\n\t\t\tif ( parseTree instanceof HqlParser.ExpressionOrPredicateContext ) {\n\t\t\t\texpressions.add( (SqmExpression<?>) parseTree.accept( this ) );\n\t\t\t}\n\t\t}\n\t\treturn expressions;","sourceCodeStart":3843,"sourceCodeEnd":3879,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L3843-L3879","documentation":"Error \"Strict JPA query language compliance was violated: use of tuples/row value constructors\" thrown in hibernate/hibernate-orm.","triggerScenarios":"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","commonSituations":"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.","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."],"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"}