hibernate/hibernate-orm · error · QueryException
Unsupported model part container
Error message
Unsupported model part container: {modelPartContainer} What it means
The HANA json_table emulation adds id columns to identify rows. addIdColumns accepts only EntityValuedModelPart, PluralAttributeMapping, and EmbeddableValuedModelPart containers. Any other ModelPartContainer type reaches the else branch and throws this QueryException.
Solutions
- Test the same query on a dialect with native json_table (PostgreSQL, Oracle) to confirm the mapping itself is valid.
- Rewrite the statement as a native HANA SQL query for this table function use.
- Simplify the involved mapping, for example replace the unusual structure with a plain embeddable or element collection.
- Report the mapping to the Hibernate issue tracker with a reproducing test; this branch indicates an emulation gap.
Defensive patterns
Strategy: try-catch
Try / catch
try {
return session.createQuery(hql).getResultList();
} catch (org.hibernate.QueryException e) {
if (e.getMessage() != null && e.getMessage().contains("Unsupported model part container")) {
// Emulation gap: fall back to native HANA SQL for this statement.
return session.createNativeQuery(nativeSql, Tuple.class).getResultList();
}
throw e;
} Prevention
- Smoke-test every json_table query on HANA before release.
- Keep a native HANA variant of complex json_table queries as a fallback.
- Report unsupported mapping shapes to Hibernate with a minimal reproducer.
When it happens
Trigger: Running a json_table query on HANA when the associated mapping exposes a model part container outside the three handled types, for example an unusual or custom mapping structure reached through the table function column mapping.
Common situations: Custom or rarely used mapping combinations (for example special collection parts or generated mappings) in an entity used with json_table on HANA. Upgrading Hibernate and hitting a mapping shape the HANA emulation never covered.
Related errors
- Can't emulate json_arrayagg filter clause when using 'null…
- Can't emulate json_objectagg filter clause when using 'null…
- Can't emulate json_objectagg 'with unique keys' clause.
- Can't emulate null on error clause on DB2
- Can't emulate null on error clause on H2
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/6712ae01de5d3538.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/json/HANAJsonTableFunction.java:341
)
);
}
return new SqlTuple( expressions, null );
}
}
private void addIdColumns(ModelPartContainer modelPartContainer, List<ColumnInfo> idColumns) {
if ( modelPartContainer instanceof EntityValuedModelPart entityValuedModelPart ) {
addIdColumns( entityValuedModelPart.getEntityMappingType(), idColumns );
}
else if ( modelPartContainer instanceof PluralAttributeMapping pluralAttributeMapping ) {
addIdColumns( pluralAttributeMapping, idColumns );
}
else if ( modelPartContainer instanceof EmbeddableValuedModelPart embeddableModelPart ) {
addIdColumns( embeddableModelPart, idColumns );
}
else {
throw new QueryException( "Unsupported model part container: " + modelPartContainer );
}
}
private void addIdColumns(EmbeddableValuedModelPart embeddableModelPart, List<ColumnInfo> idColumns) {
if ( embeddableModelPart instanceof EmbeddedCollectionPart collectionPart ) {
addIdColumns( collectionPart.getCollectionAttribute(), idColumns );
}
else {
addIdColumns( embeddableModelPart.asAttributeMapping().getDeclaringType(), idColumns );
}
}
private void addIdColumns(PluralAttributeMapping pluralAttributeMapping, List<ColumnInfo> idColumns) {
final var ddlTypeRegistry = pluralAttributeMapping.getCollectionDescriptor()
.getFactory()
.getTypeConfiguration()
.getDdlTypeRegistry();
addIdColumns( pluralAttributeMapping.getKeyDescriptor().getKeyPart(), ddlTypeRegistry, idColumns );View on GitHub (pinned to fad1729dce)