{"record":{"id":"1cd37f82b256b686","repo":"hibernate/hibernate-orm","slug":"collations","errorCode":"COLLATIONS","errorMessage":"Strict JPA query language compliance was violated: use of collations","messagePattern":"Strict JPA query language compliance was violated: use of collations","errorType":"exception","errorClass":"StrictJpaComplianceViolation","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":3825,"sourceCode":"\t}\n\n\t@Override\n\tpublic SqmUnaryOperation<?> visitUnaryExpression(HqlParser.UnaryExpressionContext ctx) {\n\t\tfinal var expression = (SqmExpression<?>) ctx.expression().accept(this);\n\t\tfinal UnaryArithmeticOperator operator = (UnaryArithmeticOperator) ctx.signOperator().accept(this);\n\t\tTypecheckUtil.assertNumeric( expression, operator );\n\t\treturn new SqmUnaryOperation<>( operator, expression, nodeBuilder() );\n\t}\n\n\t@Override\n\tpublic Object visitGroupedExpression(HqlParser.GroupedExpressionContext ctx) {\n\t\treturn ctx.getChild( 1 ).accept( this );\n\t}\n\n\t@Override\n\tpublic Object visitCollateFunction(HqlParser.CollateFunctionContext ctx) {\n\t\tif ( creationOptions.useStrictJpaCompliance() ) {\n\t\t\tthrow new StrictJpaComplianceViolation(\n\t\t\t\t\tStrictJpaComplianceViolation.Type.COLLATIONS\n\t\t\t);\n\t\t}\n\n\t\tfinal var expressionToCollate = (SqmExpression<?>) ctx.expression().accept( this );\n\t\tfinal SqmCollation castTargetExpression = (SqmCollation) ctx.collation().accept( this );\n\n\t\treturn getFunctionDescriptor(\"collate\").generateSqmExpression(\n\t\t\t\tasList( expressionToCollate, castTargetExpression ),\n\t\t\t\tnull, //why not string?\n\t\t\t\tqueryEngine()\n\t\t);\n\t}\n\n\t@Override\n\tpublic Object visitCollation(HqlParser.CollationContext ctx) {\n\t\tfinal var collation = new StringBuilder();\n\t\tfinal var simplePathContext = ctx.simplePath();","sourceCodeStart":3807,"sourceCodeEnd":3843,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L3807-L3843","documentation":"Raised as StrictJpaComplianceViolation (type COLLATIONS) from SemanticQueryBuilder.visitCollateFunction when the query uses the 'collate()' expression while strict JPA query language compliance is enabled. Collation control is an HQL extension outside the JPQL grammar, hence rejected in strict mode.","triggerScenarios":"An HQL-specific construct is used while strict JPQL compliance is enabled: Strict JPA query language compliance was violated: use of collations","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":["Strict JPA compliance forbids collations in the query. Remove the collation usage, or disable strict JPA compliance (hibernate.jpa.compliance / JpaComplianceViolation) if HQL extensions are intended."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}