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