Reputation: 137
I want to test my program with an inmemory hsqldb. To create the table I use hibernate.hbm2ddl.auto=create
But I get an exception because the schemas, defined in the entity classes by annotations, are not created before the tables are created. Now I am searching for an opportunity to create the schemas before hibernate.hbm2ddl.auto runs. To remove the schemas is not an opportunity for me, because I need them for my program.
My problem is pretty much the same like this. The different is I do not use spring, so the solution does not work for me.
Upvotes: 12
Views: 2314
Reputation: 408
Since Hibernate 5 there is a cleaner and more db-independent way, which also works with hsqldb. Add this configuration property:
hibernate.hbm2dll.create_namespaces=true
Upvotes: 3
Reputation: 3522
Assuming that you're using H2
database, you may provide init command to run with jdbc connection url. For example:
your.jdbc.url=jdbc:h2:mem:;DB_CLOSE_DELAY=-1;INIT=create schema IF NOT EXISTS your_schema
Unfortunately, the issue on hibernate jira is still unresolved https://hibernate.atlassian.net/browse/HHH-5665
Upvotes: 5