What does your Spring configuration for a datasource with embedded h2 database that you use for integration (JUnit-)tests look like? My first try with a SingleConnectionDataSource basically worked, but failed on more complicated tests involving suspended transactions. You might start h2 in tcp based server mode as well, but this is probably not the fastest communication mode for a temporary embedded database in memory. What are the possibilities and their advantages / disadvantages? And how do you create the tables / populate the database?
Update: Let's specify some concrete requirements that are important for such tests.
- The database should be temporary and in memory
- The connection should probably not use tcp to be fast
- It would be nice if I could use a database tool to inspect the content of the database during debugging
- We have to define a datasource since we can't use the application servers datasource in Unittests