{"record":{"id":"6712ae01de5d3538","repo":"hibernate/hibernate-orm","slug":"unsupported-model-part-container-modelpartcontai","errorCode":null,"errorMessage":"Unsupported model part container: {modelPartContainer}","messagePattern":"Unsupported model part container: (.+?)","errorType":"exception","errorClass":"QueryException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/function/json/HANAJsonTableFunction.java","lineNumber":341,"sourceCode":"\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn new SqlTuple( expressions, null );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void addIdColumns(ModelPartContainer modelPartContainer, List<ColumnInfo> idColumns) {\n\t\t\t\tif ( modelPartContainer instanceof EntityValuedModelPart entityValuedModelPart ) {\n\t\t\t\t\taddIdColumns( entityValuedModelPart.getEntityMappingType(), idColumns );\n\t\t\t\t}\n\t\t\t\telse if ( modelPartContainer instanceof PluralAttributeMapping pluralAttributeMapping ) {\n\t\t\t\t\taddIdColumns( pluralAttributeMapping, idColumns );\n\t\t\t\t}\n\t\t\t\telse if ( modelPartContainer instanceof EmbeddableValuedModelPart embeddableModelPart ) {\n\t\t\t\t\taddIdColumns( embeddableModelPart, idColumns );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new QueryException( \"Unsupported model part container: \" + modelPartContainer );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void addIdColumns(EmbeddableValuedModelPart embeddableModelPart, List<ColumnInfo> idColumns) {\n\t\t\t\tif ( embeddableModelPart instanceof EmbeddedCollectionPart collectionPart ) {\n\t\t\t\t\taddIdColumns( collectionPart.getCollectionAttribute(), idColumns );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\taddIdColumns( embeddableModelPart.asAttributeMapping().getDeclaringType(), idColumns );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void addIdColumns(PluralAttributeMapping pluralAttributeMapping, List<ColumnInfo> idColumns) {\n\t\t\t\tfinal var ddlTypeRegistry = pluralAttributeMapping.getCollectionDescriptor()\n\t\t\t\t\t\t.getFactory()\n\t\t\t\t\t\t.getTypeConfiguration()\n\t\t\t\t\t\t.getDdlTypeRegistry();\n\t\t\t\taddIdColumns( pluralAttributeMapping.getKeyDescriptor().getKeyPart(), ddlTypeRegistry, idColumns );","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/json/HANAJsonTableFunction.java#L323-L359","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return session.createQuery(hql).getResultList();\n} catch (org.hibernate.QueryException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Unsupported model part container\")) {\n        // Emulation gap: fall back to native HANA SQL for this statement.\n        return session.createNativeQuery(nativeSql, Tuple.class).getResultList();\n    }\n    throw e;\n}","preventionTips":["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."],"tags":["hibernate","hana","json","json-table","model-mapping","internal-error"],"backgroundTag":"hibernate-unsupported-model-mapping","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}