HSQL DB lost when spring-boot app restarts

2019-07-27 12:46发布

问题:

I'm using liquibase to initialize my db in my springboot app and it works fine until I restart - the db is re-initialized wiping all the data.

Here are my application properties

# Liquibase
liquibase.change-log=classpath:/db/changelog/iot-db.xml
liquibase.check-change-log-location=true

# Hibernate
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.show_sql=false
hibernate.hbm2ddl.auto=
entitymanager.packagesToScan=com.whatever

Are there properties which will allow me to create a persistent db instead of an in memory db?

回答1:

in application.properties, set this property:

spring.jpa.hibernate.ddl-auto = validate

source and more info.