Does spring.jpa.hibernate.ddl-auto=validate make changes in DB schema?
Solution 1
Yes in production env, the spring.jpa.hibernate.ddl-auto=update
are being passed from external .properties file.
Now I am pretty sure that spring.jpa.hibernate.ddl-auto=validate
never update the DB schema.
Thanks everyone.
Solution 2
validate
should not change your database schema.
If it does you should file an issue, although I doubt that this is what is really happening.
What I consider more likely that either
- you have multiple configurations and a different one then the one you are looking at is getting picked up.
- Something completely different is your database schema.
In order to debug this situation do the following:
- make sure you can reproduce the schema changing behavior, e.g. by adding and removing an entity.
- step by step remove everything from the project that isn't necessary for reproducing the behavior. This should leave you with a tiny project: a build file, an entity, a class representing your application to start everything up, maybe one or two configuration files.
If you actually succeed with step 2 while still reproducing the schema changing behavior update your question or directly file a bug.
If (what I'm currently expecting) at some point during step 2 the weird behavior goes away you found your culprint.
If it isn't obvious: you want to do all this using version control so you can undo/redo/review steps.
Sanchit
Updated on June 27, 2022Comments
-
Sanchit almost 2 years
On production environment I am using spring.jpa.hibernate.ddl-auto=validate but I found new columns are added in my production DB automatically.
I have done a small POC with dummy application it is not adding a column on my local system.
Can anyone help me understand what could be the issue with
spring.jpa.hibernate.ddl-auto=validate
property.Any help is appreciated.
PFA I visited the documentation but did not get enough details:
Documentation URL : enter link description here