{"record":{"id":"b95f84a02796b72b","repo":"hibernate/hibernate-orm","slug":"exporter-does-not-support-name-array-types-can-t-b95f84","errorCode":null,"errorMessage":"Exporter does not support name array types. Can't generate drop strings for: ","messagePattern":"Exporter does not support name array types\\. Can't generate drop strings for: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardUserDefinedTypeExporter.java","lineNumber":153,"sourceCode":"\tpublic String[] getSqlDropStrings(UserDefinedObjectType userDefinedType, Metadata metadata, SqlStringGenerationContext context) {\n\t\tfinal var dropType = new StringBuilder( \"drop type \" );\n\t\tif ( dialect.supportsIfExistsBeforeTypeName() ) {\n\t\t\tdropType.append( \"if exists \" );\n\t\t}\n\t\tfinal var typeName = new QualifiedNameParser.NameParts(\n\t\t\t\tIdentifier.toIdentifier( userDefinedType.getCatalog(), userDefinedType.isCatalogQuoted() ),\n\t\t\t\tIdentifier.toIdentifier( userDefinedType.getSchema(), userDefinedType.isSchemaQuoted() ),\n\t\t\t\tuserDefinedType.getNameIdentifier()\n\t\t);\n\t\tdropType.append( context.format( typeName ) );\n\t\tif ( dialect.supportsIfExistsAfterTypeName() ) {\n\t\t\tdropType.append( \" if exists\" );\n\t\t}\n\t\treturn new String[] { dropType.toString() };\n\t}\n\n\tpublic String[] getSqlDropStrings(UserDefinedArrayType userDefinedType, Metadata metadata, SqlStringGenerationContext context) {\n\t\tthrow new IllegalArgumentException( \"Exporter does not support name array types. Can't generate drop strings for: \" + userDefinedType );\n\t}\n}\n","sourceCodeStart":135,"sourceCodeEnd":156,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardUserDefinedTypeExporter.java#L135-L156","documentation":"StandardUserDefinedTypeExporter cannot generate DROP statements for named array types: getSqlDropStrings(UserDefinedArrayType) unconditionally throws this IllegalArgumentException. During schema drop with the standard exporter, any UserDefinedArrayType in the Metadata aborts the operation.","triggerScenarios":"Running drop/create-drop with the default (standard) UDT exporter while the Metadata contains a named array type (UserDefinedArrayType, e.g., @Array-based mappings registered as UDTs) and no dialect-specific exporter handles array drops.","commonSituations":"Test teardown with create-drop on mappings containing array UDTs; switching dialects away from one with array support while keeping array type mappings; drop-script generation tooling iterating all UDTs in metadata.","solutions":["Use a dialect with array-UDT support whose exporter renders the array drop statement.","Remove the named-array mapping (plain ARRAY mapping) so no UserDefinedArrayType reaches the exporter.","Drop the array type via an external migration script and disable hbm2ddl drop for it."],"exampleFix":"// before\n@Array(length = 10)\n@JdbcTypeCode(SqlTypes.ARRAY)\nprivate List<String> tags; // registers a named array UDT; drop export throws\n\n// after\n@JdbcTypeCode(SqlTypes.ARRAY)\nprivate List<String> tags; // no named UDT; drop path skips the array exporter","handlingStrategy":"type-guard","validationCode":"for (UserDefinedType udt : udtsInMetadata) {\n    if (udt instanceof UserDefinedArrayType && exporterIsStandard(dialect)) {\n        skipOrFailFast(\"array UDT \" + udt + \" cannot be dropped 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.getSqlDropStrings(userDefinedArrayType, metadata, context);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"array types\")) {\n        // use an array-capable dialect, drop the named-array mapping, or drop the type via migration script\n    } else { throw e; }\n}","preventionTips":["Avoid named array UDT mappings unless the dialect ships array DDL support.","Manage exotic type drops in migration scripts rather than hbm2ddl.","Cover drop generation in dialect integration tests, not just create."],"tags":["hibernate","udt","array-type","dialect","drop-schema","ddl"],"backgroundTag":"unsupported-type-mapping","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}