{"record":{"id":"850035a0a5195552","repo":"hibernate/hibernate-orm","slug":"sybase-ase-only-supports-passing-a-literal-or-colu","errorCode":null,"errorMessage":"Sybase ASE only supports passing a literal or column reference as XML document for xmltable() when using query columns, but got: ${arguments.xmlDocument()}","messagePattern":"Sybase ASE only supports passing a literal or column reference as XML document for xmltable\\(\\) when using query columns, but got: (.+?)","errorType":"exception","errorClass":"QueryException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/function/xml/SybaseASEXmlTableFunction.java","lineNumber":143,"sourceCode":"\t\t}\n\n\t\tprotected void addSelectableMappings(List<SelectableMapping> selectableMappings, XmlTableQueryColumnDefinition definition, XmlTableArguments arguments, SqmToSqlAstConverter converter) {\n\t\t\t// Sybase ASE can't extract XML nodes via xmltable, so we select the ordinality instead and extract\n\t\t\t// the XML nodes via xmlextract in select item. Unfortunately, this limits XPaths to literals\n\t\t\t// and documents to columns or literals, since that is the only form that can be encoded in read expressions\n\t\t\tfinal String documentFragment;\n\t\t\tif ( arguments.xmlDocument() instanceof Literal documentLiteral ) {\n\t\t\t\tdocumentFragment = documentLiteral.getJdbcMapping().getJdbcLiteralFormatter().toJdbcLiteral(\n\t\t\t\t\t\tdocumentLiteral.getLiteralValue(),\n\t\t\t\t\t\tconverter.getCreationContext().getDialect(),\n\t\t\t\t\t\tconverter.getCreationContext().getWrapperOptions()\n\t\t\t\t);\n\t\t\t}\n\t\t\telse if ( arguments.xmlDocument() instanceof ColumnReference columnReference ) {\n\t\t\t\tdocumentFragment = columnReference.getExpressionText();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new QueryException( \"Sybase ASE only supports passing a literal or column reference as XML document for xmltable() when using query columns, but got: \" + arguments.xmlDocument() );\n\t\t\t}\n\t\t\tif ( !( arguments.xpath() instanceof Literal literal)) {\n\t\t\t\tthrow new QueryException( \"Sybase ASE only supports passing an XPath literal to xmltable() when using query columns, but got: \" + arguments.xpath() );\n\t\t\t}\n\t\t\tfinal String xpathString = (String) literal.getLiteralValue();\n\t\t\tfinal String definitionPath = definition.xpath() == null ? definition.name() : definition.xpath();\n\n\t\t\tselectableMappings.add( new SelectableMappingImpl(\n\t\t\t\t\t\"\",\n\t\t\t\t\tdefinition.name(),\n\t\t\t\t\tnew SelectablePath( definition.name() ),\n\t\t\t\t\t\"xmlextract('\" + xpathString + \"['||cast(\" + Template.TEMPLATE + \".\" + definition.name() + \" as varchar)||']/\" + definitionPath + \"',\" + documentFragment + \")\",\n\t\t\t\t\tnull,\n\t\t\t\t\tnull,\n\t\t\t\t\tnull,\n\t\t\t\t\tnull,\n\t\t\t\t\tnull,\n\t\t\t\t\tnull,","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/xml/SybaseASEXmlTableFunction.java#L125-L161","documentation":"Error \"Sybase ASE only supports passing a literal or column reference as XML document for xmltable() when using query columns, but got: ${arguments.xmlDocument()}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Sybase ASE only supports passing a literal or column reference as XML document for xmltable() when using query columns.","commonSituations":"Common when running against a database whose dialect lacks this capability, when a mapping or HQL/Criteria query requests unsupported functionality, or when the wrong dialect is configured for the database in use. Error: Sybase ASE only supports passing a literal or column reference as XML document for xmltable() when using query columns.","solutions":["Pass the XML document as a literal or column reference."],"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"}