hibernate/hibernate-orm · error · IllegalArgumentException
Unsupported aggregate SQL type: {}
Error message
Unsupported aggregate SQL type: {} What it means
This is the fall-through of SybaseASEAggregateSupport.aggregateComponentExpression(): after the big switch over the component's JDBC type code, any code not handled (e.g. ARRAY, DISTINCT, NULL types) cannot be extracted out of the XML aggregate with ASE's xmlextract-based emulation, so mapping validation fails fast.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/aggregate/SybaseASEAggregateSupport.java:157
placeholder,
"cast(str_replace(str_replace(str_replace(str_replace(xmlextract(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression + "/text()" ) + " returns varchar(16384)),'<','<'),'>','>'),'"','\"'),'&','&') as " + getNarrowCastTypeName( column, typeConfiguration ) + ")"
);
case UUID:
if ( SqlTypes.isBinaryType( column.getJdbcMapping().getJdbcType().getDdlTypeCode() ) ) {
return template.replace(
placeholder,
"strtobin(str_replace(xmlextract(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression + "/text()" ) + " returns varchar(36)),'-',null))"
);
}
// Fall-through intended
default:
return template.replace(
placeholder,
"cast(xmlextract(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression + "/text()" ) + " returns varchar(16384)) as " + getNarrowCastTypeName( column, typeConfiguration ) + ")"
);
}
}
throw new IllegalArgumentException( "Unsupported aggregate SQL type: " + aggregateColumnTypeCode );
}
private static String xmlExtractArguments(String aggregateParentReadExpression, String xpathFragment) {
final String extractArguments;
final int separatorIndex;
final int patternIdx;
if ( aggregateParentReadExpression.startsWith( XML_EXTRACT_READ_START )
&& aggregateParentReadExpression.endsWith( XML_EXTRACT_READ_END )
&& (patternIdx = aggregateParentReadExpression.indexOf( XML_EXTRACT_READ_NULL_CHECK )) != -1
&& aggregateParentReadExpression.regionMatches( patternIdx + XML_EXTRACT_READ_NULL_CHECK.length(),
XML_EXTRACT_READ_INVOCATION_START, 0, XML_EXTRACT_READ_INVOCATION_START.length() )) {
final int argumentsStartIndex = patternIdx + XML_EXTRACT_READ_NULL_CHECK.length() + XML_EXTRACT_READ_INVOCATION_START.length();
separatorIndex = aggregateParentReadExpression.indexOf( XML_EXTRACT_SEPARATOR );
final var sb = new StringBuilder( aggregateParentReadExpression.length() - argumentsStartIndex + xpathFragment.length() );
sb.append( aggregateParentReadExpression, argumentsStartIndex, separatorIndex );
sb.append( '/' );
sb.append( xpathFragment );
sb.append( aggregateParentReadExpression, separatorIndex + 2, aggregateParentReadExpression.length() - XML_EXTRACT_READ_END.length() );View on GitHub (pinned to fad1729dce)
Solutions
- Remove or replace the array/exotic-typed member inside the XML aggregate embeddable (e.g. store the array as a JSON String member and deserialize in code)
- Move the array member out of the aggregate into its own column
- Use a dialect whose aggregate support handles that component type (PostgreSQL with native jsonb/xml)
Example fix
// before
@Embeddable
class Meta {
@JdbcTypeCode(SqlTypes.INTEGER_ARRAY)
List<Integer> tags; // unsupported component inside XML aggregate on ASE
}
// after
@Embeddable
class Meta {
String tagsJson; // serialize/deserialize via Jackson in accessors
} Defensive patterns
Strategy: validation
Validate before calling
// static check of embeddable members used inside XML aggregates on ASE
for (Field f : embeddableClass.getDeclaredFields()) {
JdbcTypeCode t = f.getAnnotation(JdbcTypeCode.class);
int code = t != null ? t.value() : -1;
if (code == SqlTypes.ARRAY || code == SqlTypes.INTEGER_ARRAY || code == SqlTypes.VARCHAR_ARRAY) {
if (targetDialectIsAse) throw new IllegalStateException("Array member in XML aggregate unsupported on ASE: " + f);
}
} Prevention
- Prefer String-encoded JSON members for collections inside XML aggregates when targeting multiple databases
- Run schema validation (hibernate.hbm2ddl.auto=validate) in CI against ASE to surface mapping issues at build time
When it happens
Trigger: An embeddable used inside an @JdbcTypeCode(SqlTypes.SQLXML or XML_ARRAY) aggregate that contains a field of an unhandled JDBC type — e.g. an int[]/@JdbcTypeCode(SqlTypes.INTEGER_ARRAY) member, or an exotic type like SqlTypes.NULL — on Sybase ASE.
Common situations: Porting an entity with array-typed embeddable members from PostgreSQL to Sybase; adding a new array field to an existing XML aggregate and having the ASE schema export or first query fail during bootstrap.
Related errors
- XML array '{}' in '{}' is not supported with legacy format e
- unexpected JSON array type
- Insert conflict 'do update' clause with constraint name is n
- Can't emulate offset fetch clause in subquery
- Summarization is not supported by DBMS
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/328bdc5a35efbbba.
Report an issue: GitHub.