A simple setup for unit tests is to run hsqldb in memory :
db.connection.driver_class=org.hsqldb.jdbcDriver
db.connection.url=jdbc:hsqldb:mem:aname
db.connection.username=sa
db.connection.password=
hibernate.dialect=org.hibernate.dialect.HSQLDialect
No need to start and stop. The JDBC driver will start the database.
You can also use this for demos. If you initialize the database during application startup.
Database tuning can be done using hibernate.hbm2ddl.auto .
Edit by kdgregory:To enable Maven to enable HSQLDB depending only on the test phase, use this in your POM:
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
<scope>test</scope>
</dependency>
source
share