{"record":{"id":"1681ca09fe617374","repo":"hibernate/hibernate-orm","slug":"unrecognized-schema-generation-source-type-s","errorCode":null,"errorMessage":"Unrecognized schema generation source type: '%s'","messagePattern":"Unrecognized schema generation source type: '(.+?)'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/tool/schema/SourceType.java","lineNumber":85,"sourceCode":"\tpublic static SourceType interpret(Object value, SourceType defaultValue) {\n\t\tif ( value == null ) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\tif ( value instanceof SourceType sourceType ) {\n\t\t\treturn sourceType;\n\t\t}\n\n\t\tfinal String name = value.toString().trim().replace('-', '_');\n\t\tif ( name.isEmpty() ) {\n\t\t\treturn METADATA;\n\t\t}\n\t\tfor ( var sourceType: values() ) {\n\t\t\tif ( sourceType.toString().equalsIgnoreCase(name) ) {\n\t\t\t\treturn sourceType;\n\t\t\t}\n\t\t}\n\t\tthrow new IllegalArgumentException( \"Unrecognized schema generation source type: '\" + value + \"'\");\n\t}\n}\n","sourceCodeStart":67,"sourceCodeEnd":88,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/tool/schema/SourceType.java#L67-L88","documentation":"The schema generation source type, interpreted by SourceType (used for jakarta.persistence.schema-generation create-source/drop-source style settings), must name one of metadata, script, metadata-then-script, or script-then-metadata. Hyphens are normalized to underscores and an empty value defaults to METADATA; every other value throws this IllegalArgumentException.","triggerScenarios":"SourceType.interpret receiving \"database\", \"scripts\", \"both\", or a misspelled token: no enum constant's toString matches case-insensitively after normalization, so interpretation fails.","commonSituations":"Confusing the source type with the schema action; hand-copying JPA schema-generation properties with wrong tokens; unclear which of script/metadata ordering tokens the provider expects.","solutions":["Use one of the exact values: metadata, script, metadata-then-script, script-then-metadata.","Omit the property to fall back to the default (metadata-only generation)."],"exampleFix":"# before\n<property name=\"jakarta.persistence.schema-generation.create-source\" value=\"database\"/>\n\n# after\n<property name=\"jakarta.persistence.schema-generation.create-source\" value=\"metadata-then-script\"/>","handlingStrategy":"validation","validationCode":"private static final Set<String> VALID_SOURCES = Set.of(\n        \"metadata\", \"script\", \"metadata-then-script\", \"script-then-metadata\");\n\nString token = source == null ? \"\" : source.trim().toLowerCase(Locale.ROOT);\nif (!token.isEmpty() && !VALID_SOURCES.contains(token)) {\n    throw new IllegalStateException(\"Bad schema generation source type: \" + source);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Distinguish the source type (where schema comes from) from the action (what to do).","Copy JPA schema-generation property tokens verbatim from the spec, not from memory."],"tags":["hibernate","schema-generation","jpa","configuration","illegalargumentexception"],"backgroundTag":"invalid-hibernate-enum-setting","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}