3

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?

Bacon
  • 1,229
  • 2
  • 14
  • 26
  • 2
    what is your connection url? –  Apr 28 '16 at 11:45
  • 2
    Well, most likely you are working with an in-memory database. Please read http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-sql – reto Apr 28 '16 at 11:47
  • That's my problem - it's configured as an in memory db and I need to initialize a persistent db if it doesn't exist or use it if it does. I'll mess around with the spring.datasource properties referred in the doc. Thanks – Bacon Apr 28 '16 at 12:02
  • @Bacon Did you find an embedded/in-memory solution that persists across restarts? I'm trying to something similar with clustered caching. – Pytry Jun 13 '17 at 14:05

1 Answers1

7

in application.properties, set this property:

spring.jpa.hibernate.ddl-auto = validate

source and more info.

Community
  • 1
  • 1
Luís Soares
  • 5,726
  • 4
  • 39
  • 66