hibernate/hibernate-orm · error · HibernateException

Aliases must not be null

Error message

Aliases must not be null

What it means

Error "Aliases must not be null" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/jpa/spi/NativeQueryTupleTransformer.java:76

			return alias;
		}
	}

	private static class NativeTupleImpl implements Tuple {

		private final Object[] tuple;

		private final int size;

		private final Map<String, Object> aliasToValue = new LinkedHashMap<>();
		private final Map<String, String> aliasReferences = new LinkedHashMap<>();

		public NativeTupleImpl(Object[] tuple, String[] aliases) {
			if ( tuple == null ) {
				throw new HibernateException( "Tuple must not be null" );
			}
			if ( aliases == null ) {
				throw new HibernateException( "Aliases must not be null" );
			}
			if ( tuple.length != aliases.length ) {
				throw new HibernateException( "Got different size of tuples and aliases" );
			}
			this.tuple = tuple;
			for ( int i = 0; i < tuple.length; i++ ) {
				final String alias = aliases[i];
				if ( alias != null ) {
					aliasToValue.put( alias, tuple[i] );
					aliasReferences.put( alias.toLowerCase(ROOT), alias );
				}
			}
			size = tuple.length;
		}

		@Override
		public <X> X get(String alias, Class<X> type) {
			final Object untyped = get( alias );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Provide aliases for the native query result (addScalar/alias mapping) or use a result transformer that does not need aliases.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/jpa/spi/NativeQueryTupleTransformer.java:76 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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