Our schema export used to work perfectly with Hibernate 4.x but fails after update to 5.0.
It turned out that the new SchemaMigratorImpl tries to create the foreign keys after the tables of a schema are complete. This however fails if those keys refer to tables in a different schema which have not yet been processed.
The old Configuration.generateSchemaUpdateScriptList created the foreign keys after the tables from all schema had been processed.
We created a test project on https://github.com/abenneke/sandbox/tree/master/hibernate-schema where
FirstParent from schema FIRST has children from SecondChild from schema SECOND
SecondParent from schema SECOND has children from FirstChild from schema FIRST
(both directions to make the creation order irrelevant, but note that there is no circle)
SchemaExport of Hibernate 4 created those tables this way:
whereas Hibernate 5 now fails with
Please note also that hibernate.hbm2ddl.auto with create simply reports this error and continues and update fails with a SchemaManagementException: Unable to execute schema management to JDBC target