java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails

Article

java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails

java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails



Error Log Msg : 

java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`schema name`.`table name`, CONSTRAINT `FK_aaaaaaaaaaaaaaaaa` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`))

Caution : 

자식 테이블에 입력하려는 ID가 부모 테이블에 없는 경우가 존재하였음.


Reference : 

https://stackoverflow.com/questions/5005388/cannot-add-or-update-a-child-row-a-foreign-key-constraint-fails
https://stackoverrun.com/ko/q/3240756

Dev Jinwon's Share
f
t