Service 단에서 Repository 호출 #22
nitronium102
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
repository를 service단에서 호출할 것이냐 controller 단에서 바로 호출할 것이냐에 대해 여론이 갈리는데, 관련해서 안멘께 여쭤봤습니다.
service단에서 불러오면 @transactional로 한 번 검증할 수 있기 때문에 카카오모빌리티, 쿠팡, 닥터나우 등에서는 service 단을 통해서 검증한다고 합니다!
또한 서비스 계층은 '데이터 저장 계층으로부터 읽어온 데이터를 사용하고 변경하는 등의 작업을 하는 곳'이기 때문에 repository를 서비스 단에서 호출하는 것이 계층의 목적에도 부합한다고 생각합니다.
Beta Was this translation helpful? Give feedback.
All reactions