What values can hibernate.hbm2ddl.auto take and what do they do?
Hello everyone! I'm a beginner Java developer, and while learning Hibernate, I came across the configuration parameter `hibernate.hbm2ddl.auto`. I know it's responsible for managing the database schema, but I can't fully figure out what values can be assigned to it and how each one affects the tables.
Here's an example of my `application.properties`:
```properties
spring.jpa.hibernate.ddl-auto=update
```
Currently I'm using `update`, and it seems to work: tables are created automatically. But I've seen in different projects they use `create`, `validate`, `none`. What do they mean?
I'm particularly concerned about the following:
1. If I set it to `create`, will I lose all data on every startup?
2. And `validate` — is it just a check? What happens if the table doesn't match the entity?
No answers yet.
Log in to leave an answer
Blogs