I have a table User that has many child tables defined in User class under the static hasMany grails.
I have no problem when doing User.get(3).delete() in grails. It automatically delete that user and all its child table rows. But when I want to perform the same operation in MySQL workbench. I get Error thrown by MySQL:
ERROR 1451: Cannot delete or update a parent row: a foreign key constraint fails (`test_db`.`search_stat`, CONSTRAINT `FK7A3CFFB6E64DB41` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`))
SQL Statement:
DELETE FROM `test_db`.`user` WHERE `id`='3'
I dont know what is the problem here with MySQL.