즉시 로딩은 데이터를 조회할 때 연관된 데이터까지 한 번에 불러오는 것이고
지연 로딩은 필요한 시점에 연관된 데이터를 불러오는 것
FetchType이란, JPA가 하나의 Entity를 조회할 때, 연관관계에 있는 객체들을 어떻게 가져올 것이냐를 나타내는 설정값
@ManyToOne(fetch = FetchType.EAGER)
@ManyToOne(fetch = FetchType.LAZY)
fetch의 디폴트 값은 @xxToOne에서는 EAGER, @xxToMany에서는 LAZY
'Spring > DB연동' 카테고리의 다른 글
| @Transactional 붙은 메소드 (0) | 2025.04.15 |
|---|---|
| @Transactional , JPA , SimpleJpaRepository (0) | 2025.04.15 |
| JPA기본( EntityManager, PersistenceContext ) (0) | 2025.04.02 |
| jpa에서 update (0) | 2025.03.29 |
| @Transactional 01 (0) | 2025.02.23 |