| See : https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaCreatorImpl.java#L357 The generation of the Foreign key constraint shall be filtered with foreign key table according to its table namespace, as done to create schema objects. It can be achieved the same way : //NOTE : Foreign keys must be created after all tables of all namespaces for cross namespace fks. see HHH-10420 for ( Namespace namespace : database.getNamespaces() ) { // NOTE : Foreign keys must be created after unique keys for numerous DBs. See HHH-8390 + if ( !schemaFilter.includeNamespace( namespace ) ) { + continue; + } + for ( Table table : namespace.getTables() ) { |