[Chapter 08] GenerationType, Propagation 속성 #101
Unanswered
BvrPark
asked this question in
Chapter 08. Data Persistence
Replies: 2 comments
-
Q1. 저도 말씀 그대로가 맞다고 생각합니다. Q2. 트랜잭션도 결국 비용이 생기긴 할텐데 |
Beta Was this translation helpful? Give feedback.
0 replies
-
금주 간단정리 Check List
|
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
1. GenerationType.IDENTITY vs SEQUENCE
원래 JPA는 쿼리를 임시 저장소(?) 같은 곳에다가 모아뒀다가 강제 플러시나 트랜잭션 커밋 시점 등에 쿼리를 한번에 DB에 보내는 것으로 아는데
GenerationType.IDENTITY는 DB에 기본 키 생성을 맡기기 때문에 Insert 쿼리를 날려야지 ID값을 알 수 있어서 즉시 insert 쿼리를 날리는 것으로 알고 있고 SEQUENCE는 DB가 관리하는 객체에서 ID값을 가져와서 즉시 insert 쿼리를 날리지 않는다고 알고 있습니다.
이게 insert가 엔티티를 DB에 저장할 때 엔티티의 ID값(기본키)가 아직 생성이 됐을 수도 있고 아닐 수도 있어서 두 전략에 있어서 차이가 나타나는 것이고 다른 쿼리들 select, update, delete 등은 이미 엔티티의 ID값이 생성되어 있으니까 두 전략에 차이가 없는건가요?
2. Propagation 속성
Beta Was this translation helpful? Give feedback.
All reactions