hibernate/hibernate-orm · error · MissingSqlSelectionException

ResultSet mapping specified selected alias '{}' which was no

Error message

ResultSet mapping specified selected alias '{}' which was not part of the ResultSet

What it means

Error "ResultSet mapping specified selected alias '{}' which was not part of the ResultSet" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/results/internal/complete/CompleteFetchBuilderBasicPart.java:110

		);

		return (BasicFetch<?>) parent.generateFetchableFetch(
				referencedModelPart,
				fetchPath,
				FetchTiming.IMMEDIATE,
				true,
				selectedAlias,
				domainResultCreationState
		);
	}

	private int jdbcPosition(JdbcValuesMetadata jdbcResultsMetadata, DomainResultCreationStateImpl creationStateImpl) {
		if ( selectionAlias != null ) {
			try {
				return jdbcResultsMetadata.resolveColumnPosition( selectionAlias );
			}
			catch (Exception e) {
				throw new MissingSqlSelectionException(
						"ResultSet mapping specified selected alias '" + selectionAlias
								+ "' which was not part of the ResultSet",
						e
				);
			}
		}
		else {
			if ( !creationStateImpl.arePositionalSelectionsAllowed() ) {
				throw new AssertionFailure( "Positional SQL selection resolution not allowed" );
			}
			return creationStateImpl.getNumberOfProcessedSelections() + 1;
		}
	}

	@Override
	public boolean equals(Object object) {
		if ( this == object ) {
			return true;

View on GitHub (pinned to fad1729dce)

Solutions

  1. The result-set mapping references a selected alias not present in the ResultSet. Add the alias to the SQL select list or fix the mapping.

When it happens

Trigger: A native SQL result-set mapping is invalid or misapplied: ResultSet mapping specified selected alias '<value>' which was not part of the ResultSet

Common situations: Using @SqlResultSetMapping with non-native queries, aliases missing from the ResultSet, duplicated aliases, composite-path attribute results, or unknown mapped attributes/columns.


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