hibernate/hibernate-orm · error · HibernateException
Got different size of tuples and aliases
Error message
Got different size of tuples and aliases
What it means
Error "Got different size of tuples and aliases" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/jpa/spi/NativeQueryTupleTransformer.java:79
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 );
return ( untyped != null ) ? type.cast( untyped ) : null;
}View on GitHub (pinned to fad1729dce)
Solutions
- Ensure the number of declared aliases/scalars matches the columns returned by the native query.
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/jpa/spi/NativeQueryTupleTransformer.java:79 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/8ee8565a40ebbf90.
Report an issue: GitHub.