{"record":{"id":"3888ddf761ccdc2c","repo":"hibernate/hibernate-orm","slug":"columnreference-cannot-be-de-referenced","errorCode":null,"errorMessage":"ColumnReference cannot be de-referenced","messagePattern":"ColumnReference cannot be de-referenced","errorType":"exception","errorClass":"UnsupportedMappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/mapping/ordering/ast/ColumnReference.java","lineNumber":79,"sourceCode":"\t\t\t\tsqlAstProcessingState -> new org.hibernate.sql.ast.tree.expression.ColumnReference(\n\t\t\t\t\t\ttableReference,\n\t\t\t\t\t\tcolumnExpression,\n\t\t\t\t\t\tisColumnExpressionFormula,\n\t\t\t\t\t\t// because these ordering fragments are only ever part of the order-by clause, there\n\t\t\t\t\t\t//\t\tis no need for the JdbcMapping\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tnull\n\t\t\t\t)\n\t\t);\n\t}\n\n\t@Override\n\tpublic SequencePart resolvePathPart(\n\t\t\tString name,\n\t\t\tString identifier,\n\t\t\tboolean isTerminal,\n\t\t\tTranslationContext translationContext) {\n\t\tthrow new UnsupportedMappingException( \"ColumnReference cannot be de-referenced\" );\n\t}\n\n\t@Override\n\tpublic void apply(\n\t\t\tQuerySpec ast,\n\t\t\tTableGroup tableGroup,\n\t\t\tString collation,\n\t\t\tString modelPartName,\n\t\t\tSortDirection sortOrder,\n\t\t\tNulls nullPrecedence,\n\t\t\tSqlAstCreationState creationState) {\n\t\tfinal Expression expression = resolve( ast, tableGroup, modelPartName, creationState );\n\t\t// It makes no sense to order by an expression multiple times\n\t\t// SQL Server even reports a query error in this case\n\t\tif ( ast.hasSortSpecifications() ) {\n\t\t\tfor ( SortSpecification sortSpecification : ast.getSortSpecifications() ) {\n\t\t\t\tif ( sortSpecification.getSortExpression() == expression ) {\n\t\t\t\t\treturn;","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/ordering/ast/ColumnReference.java#L61-L97","documentation":"Error \"ColumnReference cannot be de-referenced\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when an @OrderBy expression tries to dereference (navigate through) a column reference, which is a terminal.","commonSituations":"See trigger scenarios.","solutions":["Do not navigate through a basic column in an @OrderBy expression; reference only navigable attributes of the element type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}