트러블슈팅 2

[JPA] [Trouble Shooting] Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters 에러 해결

팀 프로젝트를 하던 중에 팀원이 작업이 완료돼서 pull을 받고 실행을 돌려보았는데, 이런 오류를 마주치게 되었다.  오류원문더보기For queries with named parameters you need to provide names for method parameters; Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters 구글링을 해본 결과 레포지토리에서 JPQL을 사용한 부분에서 파라미터를 전달받을때 @Param("") 어노테이션을 쓰지 않고 파라미터를 받아와서 생긴 문제였다. 친절하게도 로그에 해결 방법을 알려주고 있다.Use @Param for query method parameter..

JPA 2024.06.01

[JPA] [Trouble Shooting] 에러 Cannot delete or update a parent row: a foreign key constraint fails 참조 무결성 제약 조건 ON DELETE CASCADE

글 작성을 한 후, 댓글이 달려있는 상태에서 글 삭제 테스트를 하던 중 이런 에러를 보았다. 더보기 Cannot delete or update a parent row: a foreign key constraint fails (`learningmate`.`tb_reply`, CONSTRAINT `FKsxgehpxyljiiatkcutvuahw13` FOREIGN KEY (`board_no`) REFERENCES `tb_board` (`board_no`)) 일단 에러가 발생한 이유는 ✓ 데이터 삭제 시 해당 테이블에 연관관계가 설정 되어 있기 때문에 부모를 삭제 할 경우 부모 엔티티를 참조하는 자식 엔티티가 불안정한 상태가 되어 사전에 방지해주기 위해 에러가 발생하는 것이다. Trouble Shooting! ..

JPA 2024.04.13