강의

멘토링

로드맵

Inflearn Community Q&A

tldhs052229027's profile image
tldhs052229027

asked

Real-world! Spring Boot and JPA Utilization 1 - Web Application Development

Considerations when designing entities

@oneToOne fetch = Lazy를 입력했는데 적용이 되지 않습니다.

Written on

·

1.9K

1

@OneToOne(mappedBy = "delivery", fetch = LAZY)
private Order order;

이렇게 작성을 하면 fetch = Lazy 부분이 색깔이 변하면서 노란 전구 경고를 주는데

Specifying FetchType.LAZY for the non-owning side of the @OneToOne association will not affect the loading. The related entity will still be loaded as if the FetchType.EAGER is defined.

@OneToOne 연결의 비소유 측면에 대해 FetchType.LAZY를 지정해도 로딩에 영향을 미치지 않습니다. FetchType.EAGER가 정의된 것처럼 관련 엔터티가 계속 로드됩니다.

이렇게 경고를 주게 되네요 다른부분은 다 잘 되는데 이부분만 이러는것이 구글링을 해도 잘 모르겠네요...

스크린샷 2022-09-24 오후 7.15.33.png

 

JPA웹앱javaspring-bootspring

Quiz

41% of people got it wrong. Give it a try!

In a One-to-Many relationship, where should the Foreign Key generally be located?

Located on the 'One' side.

It is located on the 'Da' (Many) side.

It is located on the non-owner side of the relationship (Owner).

It depends on relationship settings, so there is no fixed rule.

Answer 3

1

tldhs05222님의 프로필 이미지
tldhs05222
Questioner

네 동일하게 노란 전구가 뜨면서 삭제하라고 제안합니다.

tldhs05222님의 프로필 이미지
tldhs05222
Questioner

계속해서 찾다보니 좋은 블로그를 찾아서 해결했습니다.

https://jeong-pro.tistory.com/249

감사합니다.

1

image

Order클래스에서 @OneToOne관계의 Delivery의 fetchType을 LAZY로 설정해보시겠어요?

0

tldhs05222님의 프로필 이미지
tldhs05222
Questioner

둘다 lazy로 설정해둔상태인데도 적용이 되지 않네요..스크린샷 2022-09-25 오후 3.04.50.png

제공해드리는 강의 프로젝트 소스를 실행 시에도 동일한 현상일까요?

image

 

tldhs052229027's profile image
tldhs052229027

asked

Ask a question