{"record":{"id":"a052931dafedd144","repo":"hibernate/hibernate-orm","slug":"exporter-does-not-support-name-array-types-can-t","errorCode":null,"errorMessage":"Exporter does not support name array types. Can't generate create strings for: ","messagePattern":"Exporter does not support name array types\\. Can't generate create strings for: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardUserDefinedTypeExporter.java","lineNumber":94,"sourceCode":"\t\t\t}\n\t\t\tcreateType.append( ')' );\n\t\t\tapplyUserDefinedTypeExtensionsString( createType );\n\n\t\t\tList<String> sqlStrings = new ArrayList<>();\n\t\t\tsqlStrings.add( createType.toString() );\n\t\t\tapplyComments( userDefinedType, formattedTypeName, sqlStrings );\n\t\t\treturn sqlStrings.toArray(StringHelper.EMPTY_STRINGS);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new MappingException( \"Error creating SQL create commands for UDT : \" + typeName, e );\n\t\t}\n\t}\n\n\tpublic String[] getSqlCreateStrings(\n\t\t\tUserDefinedArrayType userDefinedType,\n\t\t\tMetadata metadata,\n\t\t\tSqlStringGenerationContext context) {\n\t\tthrow new IllegalArgumentException( \"Exporter does not support name array types. Can't generate create strings for: \" + userDefinedType );\n\t}\n\n\t/**\n\t * @param udt The UDT.\n\t * @param formattedTypeName The formatted UDT name.\n\t * @param sqlStrings The list of SQL strings to add comments to.\n\t */\n\tprotected void applyComments(UserDefinedObjectType udt, String formattedTypeName, List<String> sqlStrings) {\n\t\tif ( dialect.supportsCommentOn() ) {\n\t\t\tfinal String comment = udt.getComment();\n\t\t\tif ( comment != null ) {\n\t\t\t\tsqlStrings.add( \"comment on type \" + formattedTypeName + \" is '\" + comment + \"'\" );\n\t\t\t}\n\t\t\tfor ( var column : udt.getColumns() ) {\n\t\t\t\tfinal String columnComment = column.getComment();\n\t\t\t\tif ( columnComment != null ) {\n\t\t\t\t\tsqlStrings.add( \"comment on column \" + formattedTypeName + '.' + column.getQuotedName( dialect )\n\t\t\t\t\t\t\t\t\t+ \" is '\" + columnComment + \"'\" );","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardUserDefinedTypeExporter.java#L76-L112","documentation":"StandardUserDefinedTypeExporter cannot generate CREATE statements for named array types: getSqlCreateStrings(UserDefinedArrayType) unconditionally throws this IllegalArgumentException. Dialects that do not ship their own array-UDT exporter hit it whenever a UserDefinedArrayType is present in the Metadata during schema creation.","triggerScenarios":"Metadata contains a named array type (UserDefinedArrayType, e.g., mappings using @Array or array JDBC types that register a UDT) and schema export runs with the standard exporter/default dialect, i.e., no dialect-specific UserDefinedTypeExporter overrides array handling.","commonSituations":"Entity attributes mapped to named array/VARRAY types while running on a dialect without array-UDT DDL support; porting Oracle VARRAY mappings to another database; tests enabling hbm2ddl create over metadata that includes array types.","solutions":["Use a dialect that ships array-UDT support (e.g., OracleDialect) so a specialized exporter generates the CREATE for the array type.","Re-map the attribute as a plain ARRAY/basic collection type the dialect supports natively, avoiding a named array UDT.","Create the array type with an external migration script and exclude it from hbm2ddl (hibernate.hbm2ddl.auto=none or per-mapping export off)."],"exampleFix":"// before: named array UDT on a dialect whose standard exporter cannot create it\n@Entity\npublic class Message {\n    @Array(length = 10)\n    @JdbcTypeCode(SqlTypes.ARRAY)\n    private List<String> tags;\n}\n\n// after: plain array mapping without a named UDT\n@Entity\npublic class Message {\n    @JdbcTypeCode(SqlTypes.ARRAY)\n    private List<String> tags;\n}","handlingStrategy":"type-guard","validationCode":"for (UserDefinedType udt : udtsInMetadata) {\n    if (udt instanceof UserDefinedArrayType && exporterIsStandard(dialect)) {\n        skipOrFailFast(\"array UDT \" + udt + \" cannot be created by the standard exporter\");\n    }\n}","typeGuard":"static boolean needsDialectArrayExporter(UserDefinedType udt, Dialect dialect) {\n    return udt instanceof UserDefinedArrayType\n            && dialect.getUserDefinedTypeExporter().getClass() == StandardUserDefinedTypeExporter.class;\n}","tryCatchPattern":"try {\n    exporter.getSqlCreateStrings(userDefinedArrayType, metadata, context);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"array types\")) {\n        // switch to an array-capable dialect, remap as plain ARRAY, or create the type via migration script\n    } else { throw e; }\n}","preventionTips":["Do not map named array UDTs on dialects without array-UDT DDL support.","Create exotic types with migration tooling and keep them out of hbm2ddl.","Test schema export against the exact target dialect before shipping mappings."],"tags":["hibernate","udt","array-type","dialect","ddl","schema-generation"],"backgroundTag":"unsupported-type-mapping","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}