yml 파일 설정
default_batch_fetch_size: 100
100개씩 한번에 가져옴 (쿼리가 실행되는 횟수를 줄여준다)
select * from article_comment where article_id in(100,99,98,... 4,3,2,1)이런식으로 100개씩 한번에 가져올 수 있다.
태그추가
// 한번에 하나씩 추가 public void addTag(String tagContent) { ArticleTag tag=ArticleTag.builder() .article(this) .content(tagContent) .build(); tags.add(tag); } // 한번에 여러개 추가 public void addTag(String... tagContents) { for (String tagContent : tagContents) { addTag(tagContent); } }
@ToString.ExcludetoString 할 때 이건 파고들어가지 마라(이 필드를 포함 하지 마라)
클래스에
@EqualsAndHashCode(onlyExplicitlyIncluded = true)특정 필드에
@EqualsAndHashCode.Include
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
위 애노테이션은 equals()와 hashCode()매서드를 자동으로 생성해준다.
특정 필드에 @EqualsAndHashCode.Include 를 걸어주면 해당 필드에만 equals()와 hashCode() 매서드를 생성한다.
따라서 어떤 객체들이 서로 같은지 여부를 판단할 때 이 태그가 있는 필드들이 같아야 같다고 판단을 한다.