6. 1. JPA basic concepts
c. Persistence Unit
- Named configuration declaring the entity classes and data store info
- SpringBoot properties 曙伎 朱 れ 螳.
- persistence.xml 蠍一.
12. 3. Lazy Load
a. Proxy Object
- What is di鍖erence? (in Spring Data JPA )
repository.getOne(Pk id);
repository.鍖ndOne(Pk id);
repository.鍖ndById(Pk id);
https://docs.spring.io/spring-data/data-jpa/docs/current/api/
- Spring Data Jpa JavaDoc
14. 4. OSIV
a. What is OSIV ( Open Session In View )
: 觀 襷 蟾讌 貉ろ碁ゼ ろ 豈襦 讌 蟆
( To avoid the LazyInitializationException )
DB Connection ? DB Flush ? Transaction ?
Detached ? Commit ?
When ?
15. 4. OSIV
b. Using Servlet Filter
==> DB Flush, Release Connection, Detached State
覓語 : 覈誤 碁 蟆所, DB 貉るレ 覲伎 螳 讀螳
16. 4. OSIV
c. How to use in Spring Framework
- OpenSessionInVewFilter
- OpenSessionInViewInterceptor
1. Session Open -> FlushMode.MANUAL
2. Save currentSession into ThreadLocal ( to use single session )
3. @Transactional
- Get single session from ThreadLocal & change FlushMode.AUTO
- Get Connection, begin Tx
- Execute Tx
- Commit ( Flush ) or Rollback
- Release Connection
- Change FlushMode.MANUAL
4. LazyLoad
@Transactional 覦 讌 覲蟆暑 蟷 Flush
- Get Connection ( auto commit mode )
- Execute & Release Connection
5. Session close ( change detached state )