I want generate create and drop ddl scripts using spring boot v1.4.3 with JPA - Hibernate 5.0.11.
Most answers I found use the javax.persistence.schema-generati
What I found out is that the sessionFactory
holds the schemaExport
values like createSQL, dropSQL, outputFile
and delimiter
.
The sessionFactory
as a Bean can be created like that and is then available for autowiring:
....
@Autowired
private EntityManagerFactory entityManagerFactory;
@Bean
public SessionFactory sessionFactory() {
if (entityManagerFactory.unwrap(SessionFactory.class) == null) {
throw new NullPointerException("factory is not a hibernate factory");
}
return entityManagerFactory.unwrap(SessionFactory.class);
}
That is not a working solution but could help you to manually configure the schemaExport using sessionFactory. I dont find a solution for just using the properties and setting the delimiter just there. But could be a little helper for finding the working solution.
If I find more useful infos I will update my answer.