'Spring JPA - Hibernate not adding columns to the table

I saw so many answers here, but couldn't find the one that could solve my problem.

problem: When I add the field in my entity class, hibernate does not update it in mysql automatically so I have to do it manually which is annoying.

Here is my application.properties content:

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/mysql?createDatabaseIfNotExist=true&autoReconnect=true
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update

Thanks in advance!



Solution 1:[1]

I need to see your entity class but if you want to update or add anything to your database it's better to use migration tools ( for example flyway )

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Ef