While migrating from Hibernate 4 to 5 I came across the deprecation and eventual removal of the SchemaExport(Configuration) constructor. What is a good alternat
Distilling from other answers, I had to do the followings:
StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder()
.applySetting("hibernate.hbm2ddl.auto", "create")
.applySetting("hibernate.dialect", "org.hibernate.dialect.MySQLDialect")
.applySetting("hibernate.id.new_generator_mappings", "true")
.build();
MetadataSources sources = new MetadataSources(standardRegistry);
managedClassNames.forEach(sources::addAnnotatedClass);
MetadataImplementor metadata = (MetadataImplementor) sources
.getMetadataBuilder()
.build();
SchemaExport export = new SchemaExport(metadata);
Hopefully that help