Hibernate hbm2ddl.auto validate fails on PostgreSQL after succeeding on H2
0 reputation · 12 Nov 2020, 16:59 UTC
A Hibernate application starts successfully against an embedded H2 database using hibernate.hbm2ddl.auto=create-drop. The same entity metadata and configuration profile used against production PostgreSQL with hibernate.hbm2ddl.auto=validate can produce schema validation or missing-table errors at startup. The goal is to diagnose whether the difference originates from dialect-specific DDL, identifier case or quoting, missing production schema objects, or a Hibernate version difference in schema-generation behavior.
Hibernate 5 uses hibernate.hbm2ddl.auto with dialect classes such as PostgreSQLDialect, while Hibernate 6 favors hibernate.schema-generation.* properties, so exact behavior depends on the deployed version. H2 is case-insensitive and auto-creates objects, whereas PostgreSQL enforces identifier case, schemas, privileges and constraints. No production incident has been observed; this is a design diagnosis rather than an outage report.
- Does the production Hibernate version use
hbm2ddl.autoor schema-generation properties, and which dialect is active? - Are production table and column names quoted or case-sensitive in a way that differs from the local H2 schema?
- Should production startup continue using
validate, or should schema creation move to an external migration tool?