An in-memory HSQLDB database gives DAO integration tests a lightweight alternative to contacting a slow remote or production database. With Hibernate, test-specific properties can override production connection settings. section 6.4.1
A test configuration specifies the connection details and database behavior:
- Choose the HSQLDB SQL dialect and JDBC driver, then set the URL to jdbc:hsqldb:mem:testdb. section 6.4.1
- Set the database username and password; enable hibernate.show_sql to print generated SQL while tests run. section 6.4.1
- Use hibernate.hbm2ddl.auto=create-drop to create and remove the schema for the test database. section 6.4.1
Listing 6.16. Hibernate configuration file for an in-memory HSQLDB
See the complete Hibernate properties listing for an in-memory HSQLDB database. section 6.4.1
