FetchType
- Eager : boards 클래스를 같이 가져온다. - OneToOne, ManyToOne
- Lazy :필요할 때 가져온다. - OneToMany, ManyToMany
User.java
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
private List<Board> boards = new ArrayList<>();
'온라인 강좌 > 유튜브 강의' 카테고리의 다른 글
Spring Boot 13. JPA를 이용한 커스텀 쿼리 만들기 (0) | 2024.02.21 |
---|---|
Spring Boot 12. 권한에 맞는 화면 구성 및 API 호출 (0) | 2024.02.20 |
Spring Boot 10. JPA를 이용하여 @OneToMany 관계 설정하기 (0) | 2024.02.20 |
Spring Boot 9. Spring Security를 이용한 로그인 처리 (0) | 2024.02.19 |
Spring Boot 8. JPA를 이용한 페이지 처리 및 검색 (0) | 2024.02.19 |