I have been playing around with one of the sample Spring Webflow projects, booking-faces (Spring webflow + JSF + primefaces)
Once the application is deployed, I am able to search the hotels from the database, which is quite amazing to me. I thought I would need to execute the sql in import.sql to populate the database first.
Then I search the whole project and find no where is this import.sql referenced by other configuration files.
So it’s natural for me to think hsqldb will look for all the .sql files on the classpath and execute them to populate the in-memory database.
However, when I change the sql file name from import.sql to, say, import123.sql, the data is not inserted into db. Even changing to Import.sql is no longer working.
So my question is
- Is the name of this sql file significant? Must it be import.sql? Any other choices?
- How can I get hsqldb to execute arbitrary sql files?
Yes, as you have discovered, the name is significant. Hibernate finds the import.sql file on the classpath, and runs it after creating the database schema. As far as I know, the file name is not configurable, and must be import.sql
Edit – I found the documentation at http://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/session-configuration.html
Apparently, you can set hibernate.hbm2ddl.import_files to a comma-delimited list of sql files to execute.