課程
/后端開發
/Java
/2小時學會Spring Boot
是不是jdk和maven版本問題,為什么我創建實體類后無法自動生成數據表呢?網上各種方法都試了還是不行?
2017-08-19
源自:2小時學會Spring Boot 5-1
正在回答
終于解決了!原來是要這樣配置:spring.jpa.properties.hibernate.hbm2ddl.auto=update,改成這樣就可以了!
有報錯還好,就是沒有什么報錯。后臺也沒有打出sql語句。
配置文件是這樣配置的:
(使用的是 .properties 文件)
spring.profiles.active=dev
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/user
spring.datasource.username=root
spring.datasource.password=1234
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect ?
spring.jackson.serialization.indent_output=false?
看數據庫配置是否正確, 無法通過@Entity 創建表格會報錯, 看異常信息.?
舉報
Spring Boot入門視頻教程,你將學會使用Spring Boot快速構建應用程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-08-20
終于解決了!原來是要這樣配置:spring.jpa.properties.hibernate.hbm2ddl.auto=update,改成這樣就可以了!
2017-08-20
有報錯還好,就是沒有什么報錯。后臺也沒有打出sql語句。
配置文件是這樣配置的:
(使用的是 .properties 文件)
spring.profiles.active=dev
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/user
spring.datasource.username=root
spring.datasource.password=1234
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect ?
spring.jackson.serialization.indent_output=false?
2017-08-19
看數據庫配置是否正確, 無法通過@Entity 創建表格會報錯, 看異常信息.?