com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException 異常


MySQL完整性約束破壞異常:com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException 

在單向多對一關聯關系中,如果A 持有 B 的引用(即A是多端,B是一端),也就是A 的外鍵列指向了B 的主鍵。那么此時如果先刪除B, 再刪除A(即先刪除一端,再刪除A端)。那么就會拋出上述異常。

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`hibernate_3`.`orderform`, CONSTRAINT `FK_kfvdjqhg4jcbn6vggmgbf2s5h` FOREIGN KEY (`CUSTOMER_ID`) REFERENCES `customer` (`ID`))
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance


免責聲明!

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



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