I'm using Spring embedded database in my unit tests. From Spring documentantatio:
<jdbc:embedded-database id="dataSource">
<jdbc:script location="classpath:schema.sql"/>
<jdbc:script location="classpath:test-data.sql"/>
</jdbc:embedded-database>
There are many examples all over the web which basically tell the same tale. I am able to manually create the sql statements from the production database. I could use mysqldump for example (assuming the SQL produced is accepted by HSQL). But my tables are already defined in .hbm.xml files. Is there a way to generate them automatically into the .sql files?
The purpose of all this is naturally to initialize the database. My immediate intent is to only setup the tables; I'll insert the necessary test data in the unit tests themselves.