hibernate/hibernate-orm · error · UnsupportedOperationException

Full join emulation does not support ignore case ordering…

Error message

Full join emulation does not support ignore case ordering for union queries

What it means

UnsupportedOperationException in renderFullJoinEmulationSortExpression: an ignore-case (lower()) ordering was requested for a query emulating full joins via UNION, which the emulation cannot reproduce.

Solutions

  1. Remove ignore-case ordering (lower-cased sort) from the union query using full join emulation.
  2. Apply case-insensitive ordering by selecting the lowered expression explicitly and ordering by its position/alias.
  3. Use a dialect that supports FULL JOIN natively so the emulation restrictions do not apply.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Full join emulation for a union query is combined with case-insensitive (ignore case) ordering.

Common situations: Using SortOrder with ignoreCase on a UNION query needing full join emulation; remove ignore case ordering.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/4072e57ad9d09ae1. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/sql/ast/spi/FullJoinEmulation.java:536

		final int count = tuple == null ? 1 : tuple.getExpressions().size();
		String separator = NO_SEPARATOR;
		for ( int i = 0; i < count; i++ ) {
			translator.appendSql( separator );
			renderFullJoinEmulationSortExpression(
					sortSpecification,
					sortSelectionIndexes[i],
					nullPrecedenceSelectionIndexes == null ? -1 : nullPrecedenceSelectionIndexes[i]
			);
			separator = COMMA_SEPARATOR;
		}
	}

	private void renderFullJoinEmulationSortExpression(
			SortSpecification sortSpecification,
			int sortSelectionIndex,
			int nullPrecedenceSelectionIndex) {
		if ( sortSpecification.isIgnoreCase() ) {
			throw new UnsupportedOperationException( "Full join emulation does not support ignore case ordering for union queries" );
		}
		if ( sortSelectionIndex < 0 ) {
			throw new UnsupportedOperationException( "Full join emulation requires order by expressions to be in the select list for union queries" );
		}

		final var sortOrder = sortSpecification.getSortOrder();
		final var nullPrecedence = resolveRenderedNullPrecedence( sortSpecification );
		final boolean renderNullPrecedence = nullPrecedence != null;
		final boolean supportsNullPrecedence = renderNullPrecedence && translator.getDialect().supportsNullPrecedence();
		if ( renderNullPrecedence && !supportsNullPrecedence ) {
			if ( nullPrecedenceSelectionIndex < 0 ) {
				throw new IllegalStateException( "Full join emulation null precedence index is missing for union query ordering" );
			}
			translator.appendSql( nullPrecedenceSelectionIndex + 1 );
			translator.appendSql( COMMA_SEPARATOR );
		}

		translator.appendSql( sortSelectionIndex + 1 );

View on GitHub (pinned to fad1729dce)