hibernate/hibernate-orm · error · UnsupportedMappingException

ColumnReference cannot be de-referenced

Error message

ColumnReference cannot be de-referenced

What it means

Error "ColumnReference cannot be de-referenced" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/mapping/ordering/ast/ColumnReference.java:79

				sqlAstProcessingState -> new org.hibernate.sql.ast.tree.expression.ColumnReference(
						tableReference,
						columnExpression,
						isColumnExpressionFormula,
						// because these ordering fragments are only ever part of the order-by clause, there
						//		is no need for the JdbcMapping
						null,
						null
				)
		);
	}

	@Override
	public SequencePart resolvePathPart(
			String name,
			String identifier,
			boolean isTerminal,
			TranslationContext translationContext) {
		throw new UnsupportedMappingException( "ColumnReference cannot be de-referenced" );
	}

	@Override
	public void apply(
			QuerySpec ast,
			TableGroup tableGroup,
			String collation,
			String modelPartName,
			SortDirection sortOrder,
			Nulls nullPrecedence,
			SqlAstCreationState creationState) {
		final Expression expression = resolve( ast, tableGroup, modelPartName, creationState );
		// It makes no sense to order by an expression multiple times
		// SQL Server even reports a query error in this case
		if ( ast.hasSortSpecifications() ) {
			for ( SortSpecification sortSpecification : ast.getSortSpecifications() ) {
				if ( sortSpecification.getSortExpression() == expression ) {
					return;

View on GitHub (pinned to fad1729dce)

Solutions

  1. Do not navigate through a basic column in an @OrderBy expression; reference only navigable attributes of the element type.

When it happens

Trigger: Thrown when an @OrderBy expression tries to dereference (navigate through) a column reference, which is a terminal.

Common situations: See trigger scenarios.


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