{"record":{"id":"14231ba4b0ceade3","repo":"hibernate/hibernate-orm","slug":"oracle-array-agg-emulation-requires-a-basic-plural","errorCode":null,"errorMessage":"Oracle array_agg emulation requires a basic plural return type, but resolved return type was: \" + returnType","messagePattern":"Oracle array_agg emulation requires a basic plural return type, but resolved return type was: \" \\+ returnType","errorType":"exception","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/function/array/OracleArrayAggEmulation.java","lineNumber":72,"sourceCode":"\tpublic void render(\n\t\t\tSqlAppender sqlAppender,\n\t\t\tList<? extends SqlAstNode> sqlAstArguments,\n\t\t\tPredicate filter,\n\t\t\tReturnableType<?> returnType,\n\t\t\tSqlAstTranslator<?> walker) {\n\t\trender( sqlAppender, sqlAstArguments, filter, Collections.emptyList(), returnType, walker );\n\t}\n\n\t@Override\n\tpublic void render(\n\t\t\tSqlAppender sqlAppender,\n\t\t\tList<? extends SqlAstNode> sqlAstArguments,\n\t\t\tPredicate filter,\n\t\t\tList<SortSpecification> withinGroup,\n\t\t\tReturnableType<?> returnType,\n\t\t\tSqlAstTranslator<?> translator) {\n\t\tif ( !( returnType instanceof BasicPluralType<?, ?> pluralType ) ) {\n\t\t\tthrow new SemanticException(\n\t\t\t\t\t\"Oracle array_agg emulation requires a basic plural return type, but resolved return type was: \" + returnType\n\t\t\t);\n\t\t}\n\t\tfinal boolean returnJson = pluralType.getJdbcType().getDefaultSqlTypeCode() == SqlTypes.JSON_ARRAY;\n\t\tif ( returnJson ) {\n\t\t\tsqlAppender.append( \"json_arrayagg(\" );\n\t\t}\n\t\telse {\n\t\t\tfinal String arrayTypeName = DdlTypeHelper.getTypeName(\n\t\t\t\t\treturnType,\n\t\t\t\t\ttranslator.getSessionFactory().getTypeConfiguration()\n\t\t\t);\n\t\t\tsqlAppender.append( arrayTypeName );\n\t\t\tsqlAppender.append( \"_from_json(json_arrayagg(\" );\n\t\t}\n\t\tfinal SqlAstNode firstArg = sqlAstArguments.get( 0 );\n\t\tfinal Expression arg;\n\t\tif ( firstArg instanceof Distinct distinct ) {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/array/OracleArrayAggEmulation.java#L54-L90","documentation":"Error \"Oracle array_agg emulation requires a basic plural return type, but resolved return type was: \" + returnType\" thrown in hibernate/hibernate-orm.","triggerScenarios":"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.","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: Oracle array_agg emulation requires a basic plural return type.","solutions":["Ensure the array_agg expression has a basic plural (array) return 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"}