Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPA 도입시 이해해야할 것들에 대한 정리 #28

Open
opklnm102 opened this issue Oct 3, 2017 · 3 comments
Open

JPA 도입시 이해해야할 것들에 대한 정리 #28

opklnm102 opened this issue Oct 3, 2017 · 3 comments
Assignees
Labels

Comments

@opklnm102
Copy link
Owner

JPA 도입시 이해해야할 것들

  • 본인이 작성한 JPQL이 어떤 쿼리로 생성될지 이해
  • EAGER, LAZY 로딩 전략 이해
  • persistence context 이해
  • 자동 변경 감지
  • 언제 persistence context가 flush 되는가
  • 연관관계 매핑중 mappedBy(inverse) 이해
  • JPQL 한계 인식

참고자료

@opklnm102 opklnm102 added the Java label Oct 3, 2017
@opklnm102
Copy link
Owner Author

언제 persistence context가 flush되는가

  • @transactional로 시작된 transaction이 끝날 시점
  • repository.saveAndFlush()가 호출되었을 때
  • entityManager.flush()가 호출되었을 때

@opklnm102
Copy link
Owner Author

opklnm102 commented Oct 3, 2017

JPQL 한계 인식

@opklnm102
Copy link
Owner Author

opklnm102 commented Oct 3, 2017

EAGER, LAZY 로딩 전략 이해

  • EAGER -> 연관관계가 있는 entity가 로딩될 미리 로딩
  • LAZY -> 나중에 해당 entity에 대한 사용이 있을 때 로딩
// example
class Tree {
    @Id
    Long treeId;

    @OneToMany
    List<Apple> apples;
}

class Apple {
    @Id
    Long appleId;

    @ManyToOne
    Tree tree;
}

@opklnm102 opklnm102 self-assigned this Oct 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant