7

I used file db as below:

spring.datasource.url=jdbc:h2:file:./data/meet 

And I can find file "meet.mv.db" in my working directory.

If I add tuples to the file and restart the server, the size of the file increases. However, I cannot get what is inside the file after restarting. That means there is no persistency at all.

Can anyone help me to find how to obtain persistency?

In case you need my source code: https://github.com/jihunim/meet_n_eat_server

1
  • I already commited Commented Apr 17, 2017 at 12:05

3 Answers 3

11

In application.properties:

spring.jpa.hibernate.ddl-auto=update

(from https://docs.spring.io/spring-data/jpa/docs/1.4.3.RELEASE/reference/html/jpa.repositories.html)

Sign up to request clarification or add additional context in comments.

Comments

5

I ran into a similar problem and I discovered it was because I had this property set in the persistence.xml file:

<property name="hibernate.hbm2ddl.auto" value="create-drop" /> 

Removing this line fixed the issue and data was still there after server restart.

Comments

0

Use spring.jpa.hibernate.ddl-auto=update in application.properties.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.