Issue
I connected to h2 database and i'm posting the entity while using postman. But I loose the data everytime when I rerun the my code.
spring.h2.console.enabled=true
spring.datasource.url = jdbc:h2:mem:crm/db_;DB_CLOSE_DELAY=-1
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
Is there anyway to storage data in H2Database?
Solution
Your datasource url specifies it as an in-memory database (h2:mem). You can specify it to store data in a file (in embedded mode) - see http://www.h2database.com/html/cheatSheet.html.
Answered By - Nauris Utnāns
Answer Checked By - Pedro (JavaFixing Volunteer)