码迷,mamicode.com
首页 > 其他好文 > 详细

insert时报Cannot add or update a child row: a foreign key constraint fails (`yanchangzichan`.`productstatusrecord`, CONSTRAINT `p_cu` FOREIGN KEY (`cid`) REFERENCES `customer` (`cid`))错误

时间:2017-04-20 14:13:54      阅读:623      评论:0      收藏:0      [点我收藏+]

标签:时报   解决方案   取消   const   reference   无法   sre   空值   insert   

mybatis在insert时报Cannot add or update a child row: a foreign key constraint fails (`yanchangzichan`.`productstatusrecord`, CONSTRAINT `p_cu` FOREIGN KEY (`cid`) REFERENCES `customer` (`cid`))错误,重点在“a foreign key constraint fails”,说明主表和附表有外键关联,无法插入为空的值。解决方案:1):取消表的外键 ,2)插入值不能有空值

insert时报Cannot add or update a child row: a foreign key constraint fails (`yanchangzichan`.`productstatusrecord`, CONSTRAINT `p_cu` FOREIGN KEY (`cid`) REFERENCES `customer` (`cid`))错误

标签:时报   解决方案   取消   const   reference   无法   sre   空值   insert   

原文地址:http://www.cnblogs.com/lengxiaofeng/p/6738485.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!