{"record":{"id":"98ed7c5f74c7ac40","repo":"hibernate/hibernate-orm","slug":"unsupported-user-defined-type","errorCode":null,"errorMessage":"Unsupported user-defined type: ","messagePattern":"Unsupported user-defined type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardUserDefinedTypeExporter.java","lineNumber":44,"sourceCode":"\tprotected final Dialect dialect;\n\n\tpublic StandardUserDefinedTypeExporter(Dialect dialect) {\n\t\tthis.dialect = dialect;\n\t}\n\n\t@Override\n\tpublic String[] getSqlCreateStrings(\n\t\t\tUserDefinedType userDefinedType,\n\t\t\tMetadata metadata,\n\t\t\tSqlStringGenerationContext context) {\n\t\tif ( userDefinedType instanceof UserDefinedObjectType userDefinedObjectType ) {\n\t\t\treturn getSqlCreateStrings( userDefinedObjectType, metadata, context );\n\t\t}\n\t\telse if ( userDefinedType instanceof UserDefinedArrayType userDefinedArrayType ) {\n\t\t\treturn getSqlCreateStrings( userDefinedArrayType, metadata, context );\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalArgumentException( \"Unsupported user-defined type: \" + userDefinedType );\n\t\t}\n\t}\n\n\tpublic String[] getSqlCreateStrings(\n\t\t\tUserDefinedObjectType userDefinedType,\n\t\t\tMetadata metadata,\n\t\t\tSqlStringGenerationContext context) {\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\n\t\ttry {\n\t\t\tfinal String formattedTypeName = context.format( typeName );\n\t\t\tfinal var createType =\n\t\t\t\t\tnew StringBuilder( \"create type \" )\n\t\t\t\t\t\t\t.append( formattedTypeName )","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardUserDefinedTypeExporter.java#L26-L62","documentation":"The standard user-defined-type exporter only knows how to render UserDefinedObjectType and UserDefinedArrayType. Any other UserDefinedType subtype reaching getSqlCreateStrings is rejected with this IllegalArgumentException naming the type. This is effectively an extension/programming error: custom code or a custom dialect supplied a UserDefinedType implementation the standard exporter cannot handle.","triggerScenarios":"Passing a custom UserDefinedType implementation (neither UserDefinedObjectType nor UserDefinedArrayType) into schema export: a custom dialect or metadata contributor registering its own UDT kind, or direct programmatic calls to StandardUserDefinedTypeExporter.getSqlCreateStrings with a hand-rolled type object.","commonSituations":"Teams extending Hibernate 6 UDT support with internal type hierarchies; prototypes implementing UserDefinedType directly instead of extending the object/array base types; misrouted exporter usage where a dialect-specific exporter was expected to handle the call but the standard one received it.","solutions":["Model custom UDTs as UserDefinedObjectType (standard CREATE TYPE shape) or UserDefinedArrayType so the standard exporter understands them.","Override the dialect's UserDefinedTypeExporter to render your custom type kind and ensure your dialect routes export calls to it instead of the standard exporter.","Exclude the custom type from hbm2ddl generation and create it with an external migration script."],"exampleFix":"// before\npublic class MyGeometryType implements UserDefinedType { ... } // rejected by the exporter\n\n// after\npublic class MyGeometryType extends UserDefinedObjectTypeImplementor { ... } // standard CREATE TYPE path","handlingStrategy":"type-guard","validationCode":"if (udt instanceof UserDefinedObjectType || udt instanceof UserDefinedArrayType) {\n    exporter.getSqlCreateStrings(udt, metadata, context);\n} else {\n    // route to your dialect-specific exporter or skip hbm2ddl for this type\n}","typeGuard":"static boolean isStandardExportableUdt(UserDefinedType udt) {\n    return udt instanceof UserDefinedObjectType || udt instanceof UserDefinedArrayType;\n}","tryCatchPattern":"try {\n    exporter.getSqlCreateStrings(userDefinedType, metadata, context);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unsupported user-defined type:\")) {\n        // extend UserDefinedObjectType/UserDefinedArrayType or bypass standard export for this type\n    } else { throw e; }\n}","preventionTips":["Extend UserDefinedObjectType/UserDefinedArrayType rather than implementing UserDefinedType from scratch.","Provide a dialect-specific UserDefinedTypeExporter when introducing custom UDT kinds.","Cover custom UDT kinds with an export smoke test."],"tags":["hibernate","udt","user-defined-type","exporter","extension"],"backgroundTag":"unsupported-type-mapping","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}