[Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [DELETE FROM board WHERE board_seq = ? AND board_type_seq = ?]; Cannot delete or update a parent row: a foreign key constraint fails (
forum.board_attach, CONSTRAINTboard_attach_FK_01FOREIGN KEY (board_seq,board_type_seq) REFERENCESboard(board_seq,board_type_seq)); nested exception is java.sql.SQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (forum.board_attach, CONSTRAINTboard_attach_FK_01FOREIGN KEY (board_seq,board_type_seq) REFERENCESboard(board_seq,board_type_seq))]을(를) 발생시켰습니다.
java.sql.SQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (forum.board_attach, CONSTRAINTboard_attach_FK_01FOREIGN KEY (board_seq,board_type_seq) REFERENCESboard(board_seq,board_type_seq))
@Transactional
public int delete(Integer boardSeq, Integer boardTypeSeq) {
...
//물리적으로 저장되어있는 파일 삭제
List<File> delFileList = getDeleteFileList(boardSeq, boardTypeSeq);
fileUtil.deleteFiles(delFileList);
//게시글 DB에서 삭제
code = boardRepository.delete(boardSeq, boardTypeSeq);
//파일정보 DB에서 삭제
boardAttachRepository.deleteList(boardSeq, boardTypeSeq);
log.info("code={}", code);
return code;
}