SpringBoot保存數據報錯:could not execute statement; SQL [n/a]; constraint [PRIMARY];nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement


使用SpringBoot做JAVA開發時,用Repository.save();保存數據的時候遇到了報錯:

could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

去搜索了一下解決方法,需要將主鍵設置自增,雖然不清楚為什么,但是將主鍵設置自增之后確實解決問題了,以后清楚原因之后再來補上。


免責聲明!

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



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