{"record":{"id":"8cb3a38e82d612b2","repo":"hibernate/hibernate-orm","slug":"summarization-is-not-supported-by-dbms-8cb3a3","errorCode":null,"errorMessage":"Summarization is not supported by DBMS!","messagePattern":"Summarization is not supported by DBMS!","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheSqlAstTranslator.java","lineNumber":97,"sourceCode":"\n\t@Override\n\tprotected void renderSelectTupleComparison(\n\t\t\tList<SqlSelection> lhsExpressions,\n\t\t\tSqlTuple tuple,\n\t\t\tComparisonOperator operator) {\n\t\temulateSelectTupleComparison( lhsExpressions, tuple.getExpressions(), operator, true );\n\t}\n\n\t@Override\n\tprotected void renderPartitionItem(Expression expression) {\n\t\tif ( expression instanceof Literal ) {\n\t\t\tappendSql( \"'0' || '0'\" );\n\t\t}\n\t\telse if ( expression instanceof Summarization ) {\n\t\t\t// This could theoretically be emulated by rendering all grouping variations of the query and\n\t\t\t// connect them via union all but that's probably pretty inefficient and would have to happen\n\t\t\t// on the query spec level\n\t\t\tthrow new UnsupportedOperationException( \"Summarization is not supported by DBMS!\" );\n\t\t}\n\t\telse {\n\t\t\texpression.accept( this );\n\t\t}\n\t}\n}\n","sourceCodeStart":79,"sourceCodeEnd":104,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheSqlAstTranslator.java#L79-L104","documentation":"The model-part variant of DerivedTableReference.resolveTableReference: same unconditional UnknownTableReferenceException, thrown when a ValuedModelPart's containing table is requested relative to a derived (subquery/VALUES/lateral) table reference. A derived table has exactly its derived columns and no base tables, so any model-part-to-physical-table resolution against it is a translation-path error.","triggerScenarios":"SQM paths over derived from-elements (subselect entities, VALUES lists, laterals) where later translation needs the physical table of a model part - locking, id-column resolution, subclass table lookup - and calls this overload on the DerivedTableReference.","commonSituations":"@Subselect/@Synchronize entities with polymorphic subclasses or id resolution requiring base tables; lateral joins on databases with derived-path restrictions; custom translators routing model-part resolution into derived references.","solutions":["Avoid model-part column resolution through derived references: join the real owning entity instead.","For subselect-mapped entities, ensure no inheritance/locking features force physical table resolution.","Move the derived part into a CTE backed by real tables on dialects that support it.","Upgrade Hibernate and report the query if resolution should have stayed at the derived level."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return query.getResultList();\n} catch ( UnknownTableReferenceException e ) {\n    if ( e.getMessage() != null && e.getMessage().contains(\"DerivedTableReferences\") ) {\n        // join the real owning entity instead of resolving model parts through the derived reference\n        return em.createQuery(replaceDerivedPathWithJoin(hql), type).getResultList();\n    }\n    throw e;\n}","preventionTips":["Keep inheritance chains simple on @Subselect entities - subclass tables force physical resolution that derived tables cannot satisfy.","Prefer CTE-backed or view-backed mappings over subselects when polymorphism is required.","Add integration tests covering derived-mapped entities with id resolution and locking scenarios."],"tags":["derived-table","model-part","sql-ast","table-reference","subselect"],"backgroundTag":"unknown-table-reference","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}