How to initialize in-memory HSQLDB using script via Spring

前端 未结 5 1492
死守一世寂寞
死守一世寂寞 2020-12-12 15:29

I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per this tutorial. The tutorial states that the in-memory HSQLDB database can be

5条回答
  •  旧巷少年郎
    2020-12-12 16:17

    With embedded-database we would only be able to connect to the database from the same JVM. If we have two JVMs, for performance or other constraints, we can:

    1. Instead of using an embedded-database, you can use the datasource suggested in this answer.

    2. Then initialize like Poitrek De suggested (and suggested in previous answer too). You may want to create tables only if they do not exist (as suggested here).

提交回复
热议问题