簡體   English   中英

Spring JPA - Hibernate 不向表中添加列

[英]Spring JPA - Hibernate not adding columns to the table

我在這里看到了很多答案,但找不到可以解決我問題的答案。

問題:當我在實體類中添加字段時,hibernate 不會在 mysql 中自動更新它,所以我必須手動進行,這很煩人。

這是我的 application.properties 內容:

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

提前致謝!

我需要查看您的實體類,但如果您想更新或向數據庫添加任何內容,最好使用遷移工具(例如 flyway)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM