I'm using spring boot with spring.jpa.hibernate.ddl-auto=create
, but when application restarted, all tables drops and creates again. Is there some way to avoiding re-creation for already existing tables?
Asked
Active
Viewed 1.1e+01k times
50

gorill
- 1,623
- 3
- 20
- 29
2 Answers
106
The list of option which is used in the spring boot are
- validate: validate the schema, makes no changes to the database.
- update: update the schema.
- create: creates the schema, destroying previous data.
- create-drop: drop the schema at the end of the session
- none: is all other cases.
So for avoiding the data lose you use update

Levente Orbán
- 67
- 13

sudar
- 1,446
- 2
- 14
- 26
74
spring.jpa.hibernate.ddl-auto=update
hibernate.ddl-auto should usually not be used in production.

samlewis
- 3,950
- 27
- 27
-
2@IllSc lots of discussion here: http://stackoverflow.com/questions/221379/hibernate-hbm2ddl-auto-update-in-production – samlewis Apr 14 '15 at 16:37
-
WHY should not be used in production? – lalilulelo_1986 May 07 '20 at 19:29
-
Check the link in my previous comment. – samlewis May 13 '20 at 20:39
-
Can't find this words – lalilulelo_1986 May 14 '20 at 19:31