I use H2 database for a test application, using Spring boot. Every time, when I restart the spring boot app, the data in H2 gets cleared. I am using a file instead of memory. I set the spring.jpa.hibernate.ddl-auto=update in application.properties too. Here is my application.properties file
spring.datasource.url=jdbc:h2:file:./data/demo spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password=password spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.h2.console.enabled=true spring.jpa.hibernate.ddl-auto=update What am I doing wrong here. It saves data fine. But once I shut down the app, all data get cleared.
H2is in memory database, it will get clear for every shutdownspring.datasource.url=jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE