Open
Conversation
greenn-lab
approved these changes
May 18, 2019
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| @Repository |
There was a problem hiding this comment.
JpaRepository 를 상속받으면 구현체가 org.springframework.data.jpa.repository.support.SimpleJpaRepository 로 만들어져서 이미 @Repository 를 가지게 됩니다. 그래서 여기다가 중복해서 명시하지 않아도 된대요.
| @Transactional | ||
| public class CategoryController { | ||
| @PersistenceContext | ||
| EntityManager entityManager; |
There was a problem hiding this comment.
EntityManager 를 직접 호출해서 사용하는 일은 없을 것 같아요. 바로 서비스가 호출 될 것 같아요.
There was a problem hiding this comment.
정답이라고 할 수는 없겠지만 controller layer에서 data persist를 처리하는 것보다 service layer를 하나 더 두는 게 좋은 것 같습니다!
Member
There was a problem hiding this comment.
CategoryRepository 를 EntityManager 대신 사용하면 되지 않을까 싶습니다!
occidere
approved these changes
May 20, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.