{"record":{"id":"897f8a4029c3f4a8","repo":"hibernate/hibernate-orm","slug":"no-drop-schema-syntax-supported-by-getclass-897f8a","errorCode":null,"errorMessage":"\"No drop schema syntax supported by \" + getClass().getName()","messagePattern":"\"No drop schema syntax supported by \" \\+ getClass\\(\\)\\.getName\\(\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/SpannerDialect.java","lineNumber":1192,"sourceCode":"\t@Override\n\tpublic GenerationType getNativeValueGenerationStrategy() {\n\t\treturn GenerationType.SEQUENCE;\n\t}\n\n\t@Override\n\tpublic boolean canCreateSchema() {\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic String[] getCreateSchemaCommand(String schemaName) {\n\t\tthrow new UnsupportedOperationException(\n\t\t\t\t\"No create schema syntax supported by \" + getClass().getName() );\n\t}\n\n\t@Override\n\tpublic String[] getDropSchemaCommand(String schemaName) {\n\t\tthrow new UnsupportedOperationException(\n\t\t\t\t\"No drop schema syntax supported by \" + getClass().getName() );\n\t}\n\n\t@Override\n\tpublic String getCurrentSchemaCommand() {\n\t\tthrow new UnsupportedOperationException(\n\t\t\t\t\"No current schema syntax supported by \" + getClass().getName() );\n\t}\n\n\t@Override\n\tpublic SchemaNameResolver getSchemaNameResolver() {\n\t\t// Spanner does not have a notion of database name schemas, so return \"\".\n\t\treturn (connection, dialect) -> \"\";\n\t}\n\n\t@Override\n\tpublic boolean qualifyIndexName() {\n\t\treturn false;","sourceCodeStart":1174,"sourceCodeEnd":1210,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/SpannerDialect.java#L1174-L1210","documentation":"SpannerDialect.getDropSchemaCommand() unconditionally throws UnsupportedOperationException because Cloud Spanner has no DROP SCHEMA statement (the dialect declares canCreateSchema()=false and Spanner has no schema concept). Hibernate invokes this method when schema-drop tooling (SchemaExport.drop(), hbm2ddl.auto=drop/create-drop) encounters a mapped schema/namespace name. Hitting it means your mappings or tooling requested schema-level DDL that Spanner cannot express.","triggerScenarios":"Running `new SchemaExport().drop(...)` or setting hibernate.hbm2ddl.auto=drop/create-drop while an entity maps @Table(schema=...) or the naming strategy emits a schema, on a Spanner connection; the drop phase asks the dialect for DROP SCHEMA DDL first.","commonSituations":"Test teardown with create-drop on the Spanner emulator; shutting down Spring Boot apps that register a schema-generation drop script; porting a multi-schema PostgreSQL application where teardown drops each schema.","solutions":["Remove schema names from entity mappings (@Table schema/catalog attributes) so drop tooling never asks for schema DDL.","Use hibernate.hbm2ddl.auto=none or create-only and manage Spanner DDL with the Cloud Spanner migration tool / client library DDL APIs.","Guard programmatic drops with `if (dialect.canCreateSchema())` before requesting schema-level commands.","Drop/recreate the whole Spanner database in test harnesses instead of per-schema drops."],"exampleFix":"// before\nspring.jpa.hibernate.ddl-auto=create-drop\n// with @Table(name=\"orders\", schema=\"sales\")\n\n// after\nspring.jpa.hibernate.ddl-auto=none\n// @Table(name=\"orders\") — no schema attribute","handlingStrategy":"validation","validationCode":"if (dialect.canCreateSchema()) {\n  new SchemaExport(cfg).drop(target, output);\n} else {\n  // Spanner: drop tables via explicit DDL, never schema-level commands\n}","typeGuard":null,"tryCatchPattern":"try {\n  export.drop(target, outputFile);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"drop schema\")) { /* skip schema drop; drop tables individually */ }\n  throw e;\n}","preventionTips":["Use hbm2ddl.auto=none/create-only on Spanner so the drop phase never runs.","Keep schema names out of mappings.","In tests, recreate the Spanner database/emulator instead of dropping schemas."],"tags":["hibernate","cloud-spanner","dialect","ddl","schema-export","unsupportedoperationexception"],"backgroundTag":"schema-management-unsupported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}