ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint......
今天用Hibernate建立外键的时候发现没有建立
但是创建了这个字段
情景:
user表有一字段role,role是role表id字段的外键
原因:
user表中已经有记录了,而且有的记录role这个字段在role表没有对应的id,所以就不能创建外键
解决方案:
先手动修改user.role字段,修改成已经在role表中存在的id值
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint......的更多相关文章
- Error Code: 1452 Cannot add or update a child row: a foreign key constraint fails
错误: Error Code: 1452 Cannot add or update a child row: a foreign key constraint fails 错误产生情景:我向一张带外键 ...
- Error 'Cannot add or update a child row: a foreign key constraint fails故障解决
一大早的,某从库突然报出故障:SQL线程中断! 查看从库状态: mysql> show slave status\G Slave_IO_State: Waiting for master to ...
- MySQL:ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
MySQL在删除一张表时出现 ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fa ...
- IntegrityError at /admin/users/userprofile/add/ (1452, 'Cannot add or update a child row: a foreign key constraint fails (`mxonline`.`django_admin_log`, CONSTRAINT `django_admin_log_user_id_c564eba6_
报错现象 在执行 django 后台管理的时候添加数据导致 1452 错误 报错代码 IntegrityError at /admin/users/userprofile/add/ (1452, 'C ...
- ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails ()
centos7.5 删除表空间文件失败 问题: mysql> alter table country discard tablespace; ERROR 1451 (23000): Cannot ...
- ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
mysql 删除表时提示有外键 mysql> drop tables auth_group;ERROR 1217 (23000): Cannot delete or update a paren ...
- MySQL设置外键报错 #1452 - Cannot add or update a child row: a foreign key constraint fails 解决方法
MySQL数据库,当我尝试在A表中设置B表的主键为外键时,报出错误:#1452 - Cannot add or update a child row: a foreign key constraint ...
- java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails
HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.ConstraintV ...
- insert时报Cannot add or update a child row: a foreign key constraint fails (`yanchangzichan`.`productstatusrecord`, CONSTRAINT `p_cu` FOREIGN KEY (`cid`) REFERENCES `customer` (`cid`))错误
mybatis在insert时报Cannot add or update a child row: a foreign key constraint fails (`yanchangzichan`.` ...
随机推荐
- Leetcode 35 Search Insert Position 二分查找(二分下标)
基础题之一,是混迹于各种难题的基础,有时会在小公司的大题见到,但更多的是见于选择题... 题意:在一个有序数列中,要插入数target,找出插入的位置. 楼主在这里更新了<二分查找综述>第 ...
- 读《编写可维护的javascript》笔记
第一章 基本的格式化 缩进层级:推荐 tab:4; 换行:在运算符后面换行,第二行追加两个缩进: // Good: Break after operator, following line inden ...
- 【博客美化】06.添加QQ交谈链接
博客园美化相关文章目录: [博客美化]01.推荐和反对炫酷样式 [博客美化]02.公告栏显示个性化时间 [博客美化]03.分享按钮 [博客美化]04.自定义地址栏logo [博客美化]05.添加Git ...
- CSS等高布局的6种方式
× 目录 [1]边框模拟 [2]负margin [3]table[4]absolute[5]flex[6]js 前面的话 等高布局是指子元素在父元素中高度相等的布局方式.等高布局的实现包括伪等高和真等 ...
- bootstrap-datetimepicker.js学习
之前项目运用到了这个时间控件,期间bug还是一些.抽个时间,简单地看一下. 先看一下datetimepicker.js的结构 var DateTimePicker = function(element ...
- spring源码分析之spring jmx
JMX架构定义: https://docs.oracle.com/javase/8/docs/technotes/guides/jmx/overview/architecture.html Archi ...
- zmNgFrameWork 架构升级ng1.5和md5静态资源缓存方案【angular1.x】
前言: 在我前面的博客,angular项目总结——angular + browserify + gulp + bower + less 架构分享 把我开发angular的架构进行了分享,并上传到了g ...
- Screenfly – 各种设备的屏幕和分辨率下快速测试网站
Screenfly 让你能够在各种设备的屏幕和分辨率下查看你的网站.输入网址,并点击GO开始浏览网页.Screenfly 可以使用代理服务器来模拟设备,当您查看您的网站,代理服务器模仿您所选择的设备的 ...
- [linux] is not in the sudoers file
$su - $visudo append usrname ALL=(ALL) ALL save done ctrl+d
- Elasticsearch DSL中Query与Filter的不同
Elasticsearch支持很多查询方式,其中一种就是DSL,它是把请求写在JSON里面,然后进行相关的查询. 举个DSL例子 GET _search { "query": { ...