關於「Cannot resolve table ‘user’」報錯的問題解決

  • 2020 年 10 月 28 日
  • 筆記

  springboot+vue建立映射時,後端引用@Table(name=「user」) 來對應表名 user,但引用後報錯「Cannot resolve table ‘user’」,嘗試了多篇部落客的博文後,問題解決,現在總結一下各位大佬的方法:

 

第一:View–>Tool windows–>Database–>Data Source–>MySQL輸入Host、Port和帳號密碼進行測試

 

 

 

 

 

 如果報Server returns invalid timezone. Need to set ‘serverTimezone’ property.在URL後綴加上?serverTimezone=GMT%2B8

 

 

測試成功後,Apply後點擊OK

 

 

第二:View–>Tool windows–>Persistence後雙擊「entityManagerFactory」右鍵選擇Assign Data Sources載入剛才建的Database

 

 

 

 

 

 上述兩步執行後還報「Cannot resolve table ‘user’」的話,嘗試以下操作File–>Settings–>Editor–>Code Style–>Inspections取消JPA的勾選框。