{"record":{"id":"4072e57ad9d09ae1","repo":"hibernate/hibernate-orm","slug":"full-join-emulation-does-not-support-ignore-case-o","errorCode":null,"errorMessage":"Full join emulation does not support ignore case ordering for union queries","messagePattern":"Full join emulation does not support ignore case ordering for union queries","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/sql/ast/spi/FullJoinEmulation.java","lineNumber":536,"sourceCode":"\t\tfinal int count = tuple == null ? 1 : tuple.getExpressions().size();\n\t\tString separator = NO_SEPARATOR;\n\t\tfor ( int i = 0; i < count; i++ ) {\n\t\t\ttranslator.appendSql( separator );\n\t\t\trenderFullJoinEmulationSortExpression(\n\t\t\t\t\tsortSpecification,\n\t\t\t\t\tsortSelectionIndexes[i],\n\t\t\t\t\tnullPrecedenceSelectionIndexes == null ? -1 : nullPrecedenceSelectionIndexes[i]\n\t\t\t);\n\t\t\tseparator = COMMA_SEPARATOR;\n\t\t}\n\t}\n\n\tprivate void renderFullJoinEmulationSortExpression(\n\t\t\tSortSpecification sortSpecification,\n\t\t\tint sortSelectionIndex,\n\t\t\tint nullPrecedenceSelectionIndex) {\n\t\tif ( sortSpecification.isIgnoreCase() ) {\n\t\t\tthrow new UnsupportedOperationException( \"Full join emulation does not support ignore case ordering for union queries\" );\n\t\t}\n\t\tif ( sortSelectionIndex < 0 ) {\n\t\t\tthrow new UnsupportedOperationException( \"Full join emulation requires order by expressions to be in the select list for union queries\" );\n\t\t}\n\n\t\tfinal var sortOrder = sortSpecification.getSortOrder();\n\t\tfinal var nullPrecedence = resolveRenderedNullPrecedence( sortSpecification );\n\t\tfinal boolean renderNullPrecedence = nullPrecedence != null;\n\t\tfinal boolean supportsNullPrecedence = renderNullPrecedence && translator.getDialect().supportsNullPrecedence();\n\t\tif ( renderNullPrecedence && !supportsNullPrecedence ) {\n\t\t\tif ( nullPrecedenceSelectionIndex < 0 ) {\n\t\t\t\tthrow new IllegalStateException( \"Full join emulation null precedence index is missing for union query ordering\" );\n\t\t\t}\n\t\t\ttranslator.appendSql( nullPrecedenceSelectionIndex + 1 );\n\t\t\ttranslator.appendSql( COMMA_SEPARATOR );\n\t\t}\n\n\t\ttranslator.appendSql( sortSelectionIndex + 1 );","sourceCodeStart":518,"sourceCodeEnd":554,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/FullJoinEmulation.java#L518-L554","documentation":"Error \"Full join emulation does not support ignore case ordering for union queries\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Full join emulation for a union query is combined with case-insensitive (ignore case) ordering.","commonSituations":"Using SortOrder with ignoreCase on a UNION query needing full join emulation; remove ignore case ordering.","solutions":["Remove ignore-case ordering (lower-cased sort) from the union query using full join emulation.","Apply case-insensitive ordering by selecting the lowered expression explicitly and ordering by its position/alias.","Use a dialect that supports FULL JOIN natively so the emulation restrictions do not apply."],"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"}