无法删除或更新父行:外键约束失败:

时间:2019-04-25 10:42:31

标签: mysql hibernate spring-mvc

每当我单击删除按钮时,我都想通过ID删除记录。

@RequestMapping(value = { "/delete-faculty-{id}" }, method = RequestMethod.GET)
    public String deleteUser(@PathVariable int id) {
       danceFacultyService.deleteById(id);
        return "redirect:/facultyList";
    }

//In error log it shows:com.sun.proxy.$Proxy52.deleteById(Unknown Source)
com.neosoft.danceacademy.controller.DanceFacultyController.deleteUser(DanceFacultyController.java:107)

//I am not getting whats wrong here

CREATE TABLE DANCEFACULTY_DANCETYPE(
dancefaculty_id BIGINT NOT NULL,
dancetypesid BIGINT NOT NULL,
PRIMARY KEY (dancefaculty_id,dancetypesid),
  CONSTRAINT DANCEFACULTY_DANCETYPE_df_foreign FOREIGN KEY (dancefaculty_id) 
 REFERENCES DANCE_FACULTY (id),
   CONSTRAINT DANCEFACULTY_DANCETYPE_dt_foreign  FOREIGN KEY (dancetypesid) 
 REFERENCES DANCE_TYPES (id)
  );

0 个答案:

没有答案