org.springframework.dao.InvalidDataAccessResourceUsageException


org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet

 

往上看報錯

 

 發現是數據庫表中字段名寫錯了。。。

因為使用了JpaRepository,有一定的映射規則,對於表對應的實體類的成員變量有嚴格的限制。

例如,數據庫列名為student_id、student_name,則Java的Student類的成員變量要命名為studentId和studentName。即把下划線改為駝峰寫法。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM