Simple and reliable in memory database for fast java integration tests with support for JPA

topchef picture topchef · Aug 9, 2010 · Viewed 11.6k times · Source

My integration tests would run much faster if I used in-memory-database instead of PostgreSQL. I use JPA (Hibernate) and I need an in-memory-database that would be easy to switch to using JPA, easy to setup, and reliable. It needs to support JPA and Hibernate (or vice verse if you will) rather extensively since I have no desire to adopt my data access code for tests.

What database is the best choice given requirements above?

Answer

Pascal Thivent picture Pascal Thivent · Aug 10, 2010

For integration testing, I now use H2 (from the original author of HSQLDB) that I prefer over HSQLDB. It is faster (and I want my tests to be as fast as possible), it has some nice features like the compatibility mode, the dev team is very responsive (while HSQLDB remained dormant for years until very recently).