hibernate/hibernate-orm · error · QueryException

Sybase ASE only supports passing a literal or column referen

Error message

Sybase ASE only supports passing a literal or column reference as XML document for xmltable() when using query columns, but got: ${arguments.xmlDocument()}

What it means

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.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/xml/SybaseASEXmlTableFunction.java:143

		}

		protected void addSelectableMappings(List<SelectableMapping> selectableMappings, XmlTableQueryColumnDefinition definition, XmlTableArguments arguments, SqmToSqlAstConverter converter) {
			// Sybase ASE can't extract XML nodes via xmltable, so we select the ordinality instead and extract
			// the XML nodes via xmlextract in select item. Unfortunately, this limits XPaths to literals
			// and documents to columns or literals, since that is the only form that can be encoded in read expressions
			final String documentFragment;
			if ( arguments.xmlDocument() instanceof Literal documentLiteral ) {
				documentFragment = documentLiteral.getJdbcMapping().getJdbcLiteralFormatter().toJdbcLiteral(
						documentLiteral.getLiteralValue(),
						converter.getCreationContext().getDialect(),
						converter.getCreationContext().getWrapperOptions()
				);
			}
			else if ( arguments.xmlDocument() instanceof ColumnReference columnReference ) {
				documentFragment = columnReference.getExpressionText();
			}
			else {
				throw 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() );
			}
			if ( !( arguments.xpath() instanceof Literal literal)) {
				throw new QueryException( "Sybase ASE only supports passing an XPath literal to xmltable() when using query columns, but got: " + arguments.xpath() );
			}
			final String xpathString = (String) literal.getLiteralValue();
			final String definitionPath = definition.xpath() == null ? definition.name() : definition.xpath();

			selectableMappings.add( new SelectableMappingImpl(
					"",
					definition.name(),
					new SelectablePath( definition.name() ),
					"xmlextract('" + xpathString + "['||cast(" + Template.TEMPLATE + "." + definition.name() + " as varchar)||']/" + definitionPath + "'," + documentFragment + ")",
					null,
					null,
					null,
					null,
					null,
					null,

View on GitHub (pinned to fad1729dce)

Solutions

  1. Pass the XML document as a literal or column reference.

When it happens

Trigger: 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.

Common situations: 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.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/850035a0a5195552. Report an issue: GitHub.