hibernate/hibernate-orm · error · SemanticException

Oracle array_agg emulation requires a basic plural return ty

Error message

Oracle array_agg emulation requires a basic plural return type, but resolved return type was: " + returnType

What it means

Error "Oracle array_agg emulation requires a basic plural return type, but resolved return type was: " + returnType" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/array/OracleArrayAggEmulation.java:72

	public void render(
			SqlAppender sqlAppender,
			List<? extends SqlAstNode> sqlAstArguments,
			Predicate filter,
			ReturnableType<?> returnType,
			SqlAstTranslator<?> walker) {
		render( sqlAppender, sqlAstArguments, filter, Collections.emptyList(), returnType, walker );
	}

	@Override
	public void render(
			SqlAppender sqlAppender,
			List<? extends SqlAstNode> sqlAstArguments,
			Predicate filter,
			List<SortSpecification> withinGroup,
			ReturnableType<?> returnType,
			SqlAstTranslator<?> translator) {
		if ( !( returnType instanceof BasicPluralType<?, ?> pluralType ) ) {
			throw new SemanticException(
					"Oracle array_agg emulation requires a basic plural return type, but resolved return type was: " + returnType
			);
		}
		final boolean returnJson = pluralType.getJdbcType().getDefaultSqlTypeCode() == SqlTypes.JSON_ARRAY;
		if ( returnJson ) {
			sqlAppender.append( "json_arrayagg(" );
		}
		else {
			final String arrayTypeName = DdlTypeHelper.getTypeName(
					returnType,
					translator.getSessionFactory().getTypeConfiguration()
			);
			sqlAppender.append( arrayTypeName );
			sqlAppender.append( "_from_json(json_arrayagg(" );
		}
		final SqlAstNode firstArg = sqlAstArguments.get( 0 );
		final Expression arg;
		if ( firstArg instanceof Distinct distinct ) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Ensure the array_agg expression has a basic plural (array) return type.

When it happens

Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Oracle array_agg emulation requires a basic plural return type.

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: Oracle array_agg emulation requires a basic plural return type.


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