쌓고 쌓다
Lombok 사용시 Boolean 타입 @Data, @Getter 주의 본문
반응형
Lombok 사용시 이상하게
boolean isParent 필드의 getIsParent() 메서드가 생성이 안되는 것이다.
@Entity
@Data
public class Comment {
private boolean isParent;
}

boolean 타입인 경우 getter는 getXXX로 생성이 되는 것이 아니라.
isXXX로 생성이 된다. boolean 타입은 getter를 관례상 isXXX로 작성하는 것이다.
아래와 같이 변경하여 사용해주자.
Comment 컬럼명 변경
alter table comment CHANGE is_parent parent int;
Comment 필드 변경
private boolean parent;

반응형
'Dev Log' 카테고리의 다른 글
| [프로그래머스] 삼총사 C++ 풀이 및 해설 (2) | 2023.10.02 |
|---|---|
| Cannot handle managed/back reference 'defaultReference': back reference type ... not compatible with managed type ... (0) | 2023.10.01 |
| [스프링 부트] 회원 정보(세션)로 게시글 작성 - 32 (0) | 2023.10.01 |
| 로그인 여부에 따라 헤더(네비게이션) 바꾸기 - 세션 (0) | 2023.09.30 |
| 바뀌는 태그와 이벤트 등록 - Uncaught TypeError: Cannot read properties of null (0) | 2023.09.28 |