在删除主表数据时,报了一个异常

Cannot delete or update a parent row: a foreign key constraint fails

原因是主表中还包含字表的数据,不能删除与这张表或数据有关联的字段,所以无法删除

解决办法:在创建数据库的外键时,将删除的动作配置由RESTRICT改成cascade,就可以解决.

Hibernate级联删除时:Cannot delete or update a parent row: a foreign key constraint fails异常的更多相关文章

  1. 【转】表删除时 Cannot delete or update a parent row: a foreign key constraint fails 异常处理

    转载地址:http://lijiejava.iteye.com/blog/790478 有两张表,结构如下: t_item:                          t_bid: id    ...

  2. 表删除时 Cannot delete or update a parent row: a foreign key constraint fails 异常处理

    有两张表,结构如下: t_item:                          t_bid: id        int                     id        int n ...

  3. Mysql - 删除表时出现: 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 ...

  4. mysql删除有外链索引数据,Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法

    mysql删除有外链索引数据Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法查询:DELETE ...

  5. mysql 在删除数据出现Cannot delete or update a parent row: a foreign key constraint fails 这个该如何解决

    mysql 在删除数据出现Cannot delete or update a parent row: a foreign key constraint fails  这个该如何解决 可以这样解决: S ...

  6. 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 ...

  7. Mysql之1451 - Cannot delete or update a parent row: a foreign key constraint fails...解决办法记录

    今天使用delete语句删除一张表中的一条信息时,提示了这么一个错误:1451 - Cannot delete or update a parent row: a foreign key constr ...

  8. 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 ...

  9. MySQL主从复制中断,报“Error on master: message (format)='Cannot delete or update a parent row: a foreign key constraint fails' error code=1217” 错误

    前几天,发现从库挂了,具体报错信息如下: 分析思路 1. 因为我采用的是选择性复制,只针对以下几个库进行复制: card,upay,deal,monitor,collect.所以,不太可能出现对于sa ...

随机推荐

  1. JSP直接连接sql2008数据库并显示

    <%@ page contentType="text/html; charset=utf-8" language="java" errorPage=&qu ...

  2. 使用Perl5获取有道词典释义

    Get Word Definition from dict.youda.com via Perl Script 获取基本释义 Get Basic Definition http://dict.youd ...

  3. 正确配置Linux系统ulimit值的方法【转】

    转自:http://www.cnblogs.com/ibook360/archive/2012/05/11/2495405.html 在Linux下面部署应用的时候,有时候会遇上Socket/File ...

  4. Hibernate,JPA注解@EmbeddedId

    定义组合主键的几种语法: 将组件类注解为@Embeddable,并将组件的属性注解为@Id 将组件的属性注解为@EmbeddedId 将类注解为@IdClass,并将该实体中所有属于主键的属性都注解为 ...

  5. Shell 字符串比较

    转自网络 Shell字符串比较 收藏 Shell 中整数比较方法及字符串的比较方法,如等于,不等于,大于,大于等于,小于,等等. 二元比较操作符,比较变量或者比较数字.注意数字与字符串的区别. --- ...

  6. Java可变长参数方法调用问题

    不说废话,直接上代码: package mytest; import java.util.List; public class TestClass { public void method(List& ...

  7. layer

    一款实用的web提示框架!下面是实用这款框架的实例 html代码 <p class='layer_notice'>我们是否是好惹的</p> <input type=&qu ...

  8. css3 动画 执行一次

    function testAnim(x) {   $('#animationSandbox').removeClass().addClass(x + ' animated').one('webkitA ...

  9. shell基础知识

    Shell 学习基础 1.组合命令的符号 管道,将前面一个命令的结果作为后面一个命令的输入 分号,顺序执行用分号分割的命令 重定向,重定向包括三种:输入重定向.输出重定向.错误重定向,以7个不同的符号 ...

  10. js调用MVC3自带js验证

    验证: if ($(this).is("form")) {                        return $(this).validate().checkForm() ...