본문 바로가기

CS3

[JPA] N+1 문제 N+1 문제란? N+1 문제는 JPA등의 ORM(Object-Relational Mapping) 프레임워크에서 발생하는 성능 이슈. 한 번의 쿼리로 여러 개의 주 엔터티(예: Member)를 조회한 후, 각 주 엔터티에 연결된 하위 엔터티(예: Order)를 개별적으로 조회할 때 발생합니다. N+1 문제가 발생하는 이유 예를 들어와 `Order`가 아래와 같이 설정되어 있다고 가정해 봅시다. @Entity public class Member { @Id @GeneratedValue private Long id; @OneToMany(mappedBy = "member", fetch = FetchType.EAGER) private List orders = new ArrayList(); // getters and.. 2023. 9. 6.
컴포지트 패턴 (Composite pattern) 디자인 패턴 중 하나인 컴포지트 패턴에 대해 알아보려 한다. 우선 위키에 뭐라고 설명하고 있는지 한번 보자. In software engineering, the composite pattern is a partitioning design pattern. The composite pattern describes a group of objects that are treated the same way as a single instance of the same type of object. The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. - 위키 - 쉽게 보자면 컴포지트.. 2023. 8. 22.
String & StringBuffer & StringBuilder String String (Java Platform SE 8 ) Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence represented by the argum docs.oracle.com 1. 불변성 위 이미지는 스트링이 상수, 즉 불변객체라는 말을 하고 있다. Strings are constant; their values cannot be ch.. 2023. 6. 20.