{"record":{"id":"372757c0dc0a4f04","repo":"hibernate/hibernate-orm","slug":"unsupported-frame-kind","errorCode":null,"errorMessage":"Unsupported frame kind: ","messagePattern":"Unsupported frame kind: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java","lineNumber":5601,"sourceCode":"\t\t\tcase CURRENT_ROW:\n\t\t\t\tappend( \"current row\" );\n\t\t\t\tbreak;\n\t\t\tcase UNBOUNDED_PRECEDING:\n\t\t\t\tappend( \"unbounded preceding\" );\n\t\t\t\tbreak;\n\t\t\tcase UNBOUNDED_FOLLOWING:\n\t\t\t\tappend( \"unbounded following\" );\n\t\t\t\tbreak;\n\t\t\tcase OFFSET_PRECEDING:\n\t\t\t\texpression.accept( this );\n\t\t\t\tappend( \" preceding\" );\n\t\t\t\tbreak;\n\t\t\tcase OFFSET_FOLLOWING:\n\t\t\t\texpression.accept( this );\n\t\t\t\tappend( \" following\" );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new UnsupportedOperationException( \"Unsupported frame kind: \" + kind );\n\t\t}\n\t}\n\n\tprotected void renderRowNumber(SelectClause selectClause, QueryPart queryPart) {\n\t\tif ( selectClause.isDistinct() ) {\n\t\t\tappendSql( \"dense_rank()\" );\n\t\t}\n\t\telse {\n\t\t\tappendSql( \"row_number()\" );\n\t\t}\n\t\tvisitOverClause( emptyList(), getSortSpecificationsRowNumbering( selectClause, queryPart ) );\n\t}\n\n\tpublic static boolean isParameter(Expression expression) {\n\t\treturn expression instanceof JdbcParameter\n\t\t\t|| expression instanceof SqmParameterInterpretation;\n\t}\n","sourceCodeStart":5583,"sourceCodeEnd":5619,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java#L5583-L5619","documentation":"While rendering the frame of a window function (rows/range between ...), the translator switches over FrameKind to emit SQL text for each frame boundary. Any FrameKind value not covered by the cases (the default branch) throws this UnsupportedOperationException, meaning the requested window frame boundary kind cannot be rendered by this translator/dialect path.","triggerScenarios":"An HQL/Criteria window function with an explicit frame specification whose frame kind is not handled in the dialect's frame rendering path - e.g. a frame end/exclusion combination the generic translator does not render, or a dialect-specific translator override that supports fewer FrameKinds than the model produced.","commonSituations":"Using Hibernate 6.4+ HQL window functions with frame clauses on dialects with partial support; Criteria FunctionFramework window definitions with FrameKind combinations such as GROUPS-mode boundaries; upgrading Hibernate where new FrameKinds were added but a dialect translator was not updated.","solutions":["Simplify the window frame to the common kinds (unbounded preceding/current row/offset preceding/following/unbounded following)","Drop the explicit frame and rely on the function's default frame, or express the computation as a native query","Check the dialect's SqlAstTranslator for supported frame kinds and align the query to them","Upgrade Hibernate - window frame rendering coverage grows by version; report the unsupported kind to HHH if all standard kinds should work"],"exampleFix":"// before\n// HQL: sum(x) over(order by y rows between 1 preceding and 1 following) with an unsupported kind for the dialect\n\n// after\n// HQL: sum(x) over(order by y rows between unbounded preceding and current row)","handlingStrategy":"fallback","validationCode":"// Limit window frames to the universally rendered kinds\nSet<FrameKind> safe = Set.of(FrameKind.UNBOUNDED_PRECEDING, FrameKind.PRECEDING,\n        FrameKind.CURRENT_ROW, FrameKind.FOLLOWING, FrameKind.UNBOUNDED_FOLLOWING);\nif (!safe.contains(frame.getKind())) { /* use default frame or native SQL */ }","typeGuard":null,"tryCatchPattern":"try {\n    query.list();\n} catch (UnsupportedOperationException e) {\n    if (String.valueOf(e.getMessage()).startsWith(\"Unsupported frame kind\")) {\n        // retry with the window function's default frame or native query\n    } else throw e;\n}","preventionTips":["Prefer default frames or simple unbounded-preceding..current-row windows","Validate window function queries against the target dialect in integration tests","Keep complex analytic frames in native SQL"],"tags":["hibernate","window-function","sql-translator","frame-clause","dialect-support"],"backgroundTag":"window-function-frame-unsupported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}