hibernate/hibernate-orm · error · UnsupportedOperationException

{className} does not support array literals

Error message

{className} does not support array literals

What it means

Error "{className} does not support array literals" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java:5152

			return maxLength == null
					? elementTypeName + " array"
					: elementTypeName + " array[" + maxLength + "]";
		}
		else {
			return null;
		}
	}

	/**
	 * Append an array literal with the given elements to the given {@link SqlAppender}.
	 */
	public void appendArrayLiteral(
			SqlAppender appender,
			Object[] literal,
			JdbcLiteralFormatter<Object> elementFormatter,
			WrapperOptions wrapperOptions) {
		if ( !supportsStandardArrays() ) {
			throw new UnsupportedOperationException( getClass().getName() + " does not support array literals" );
		}
		appender.appendSql( "ARRAY[" );
		if ( literal.length != 0 ) {
			if ( literal[0] == null ) {
				appender.appendSql( "null" );
			}
			else {
				elementFormatter.appendJdbcLiteral( appender, literal[0], this, wrapperOptions );
			}
			for ( int i = 1; i < literal.length; i++ ) {
				appender.appendSql( ',' );
				if ( literal[i] == null ) {
					appender.appendSql( "null" );
				}
				else {
					elementFormatter.appendJdbcLiteral( appender, literal[i], this, wrapperOptions );
				}
			}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Pass the array as a bind parameter instead of an inline literal.
  2. Use a dialect that supports array literals.

When it happens

Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: the dialect class does not support array literals.

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: the dialect class does not support array literals.


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