문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
java:jpa:cache [2014/06/10 23:55] kwon37xi |
java:jpa:cache [2015/10/17 12:07] (현재) kwon37xi |
||
---|---|---|---|
줄 1: | 줄 1: | ||
====== JPA Second Level Cache ====== | ====== JPA Second Level Cache ====== | ||
+ | * [[java: | ||
* Hibernate 4 기반으로 살펴보는 JPA2 Second Level Cache. | * Hibernate 4 기반으로 살펴보는 JPA2 Second Level Cache. | ||
* 아직까지 살펴본바로는, | * 아직까지 살펴본바로는, | ||
* 아래 나오는 Property Key의 대부분은 [[https:// | * 아래 나오는 Property Key의 대부분은 [[https:// | ||
+ | |||
+ | ===== Evict All ===== | ||
+ | 현재 Hibernate 구현체(4.3)은 JPA의 Cache.evictAll() 호출시에 모든 Region을 evict하지 않고 오로지 Entity 관련 region에 대해서만 evict를 수행한다. | ||
+ | |||
+ | 전체 리젼을 다 evict하려면 Hibernate의 '' | ||
+ | 관련 구현은 [[https:// | ||
+ | |EntityManagerFactoryImpl.java]]에 있다. | ||
+ | |||
+ | <code java> | ||
+ | // JPA 2.0사용시 | ||
+ | HibernateEntityManagerFactory hemf = (HibernateEntityManagerFactory)entityManagerFactory; | ||
+ | org.hibernate.Cache cache = hemf.getSessionFactory().getCache(); | ||
+ | |||
+ | // JPA 2.1 사용시 | ||
+ | SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class) | ||
+ | org.hibernate.Cache cache = sessionFactory.getCache(); | ||
+ | |||
+ | // 전체 eviction | ||
+ | cache.evictEntityRegions(); | ||
+ | cache.evictQueryRegions(); | ||
+ | cache.evictCollectionRegions(); | ||
+ | </ | ||
+ | |||
+ | ===== 참고 ===== | ||
+ | * [[http:// | ||