I'm using H2 database as the persistence layer for unit testing an application. I'm using H2 as an in-memory database.
The unit tests load a large volume of data into a single
transactions table (the database is created with only this table in it). There is a thread that creates, updates and deletes rows based on some defined processing rules. The operations are sequential and work well, at full execution speed.
I then added another thread that reads from the table the number of records that were inserted (it's just a
select count(*) from transactions) to see where I'm at with the data load and H2 started spiting out an exception with
TABLE_OR_VIEW_NOT_FOUND_1 (42102 error code). The table it cannot find is the
transactions table. I'm using a JdbcConnectionPool to get two connections to the database.
I know the H2 database engine is single threaded but my understanding is that it locks the entire table for concurrent operations witch means the reads will be blocked by writes and the other way around but not get a dumb error like that.
Has anyone encountered this? What can be the cause?