정리하기/DR

[Daily Report] 22.01.21 - Column 'cat_id' cannot be null 이슈 해결

pythaac 2022. 1. 21. 21:37

Memo

Column ‘cat_id’ cannot be null 이슈 해결과정

l  [가정1] save 메서드의 returncat_id가 실려오지 않음

-        확인해보니 savereturncat_id가 존재

l  [가정2] schema의 불일치

-        cat_idjavaentity 객체에서 Long, shecma에서 BIGINT로 정의

-        그러나 JPA DB 자료형 맵핑 확인시 LongBIGINT가 매핑됨

l  cat_idTistoryCategorycat_id가 아닌 @OneToOne Categorycat_id

-        Category를 채워 해결 완료

 

Cat_parent 수정 필요

l  cat_parent 값이 tistory_cat_id

-        cat_id로 변경 필요

l  cat_parentcat_id의 연관성

-        현재는 관련없는 값으로 insert

l  [보류] Parent entity 생성

l  [해결방법] create 후 일괄 치환

-        parent가 없을 때 (상관x)

-        t_parent에 대한 cat_id가 없을 때 (업데이트)

-        t_parent에 대한 cat_id가 있지만 다를 때 (업데이트)

 

New

CrudRepository save entity가 맵핑을 멤버로 갖는 경우

l  TistoryCategory의 멤버 중

-        @OneToOne Category category

-        해당 멤버를 채워서 save해야함