문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
java:jpa:cache [2015/03/17 00:30] 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. | ||
| * 아직까지 살펴본바로는, | * 아직까지 살펴본바로는, | ||
| 줄 8: | 줄 9: | ||
| 전체 리젼을 다 evict하려면 Hibernate의 '' | 전체 리젼을 다 evict하려면 Hibernate의 '' | ||
| + | 관련 구현은 [[https:// | ||
| + | |EntityManagerFactoryImpl.java]]에 있다. | ||
| + | |||
| <code java> | <code java> | ||
| + | // JPA 2.0사용시 | ||
| HibernateEntityManagerFactory hemf = (HibernateEntityManagerFactory)entityManagerFactory; | HibernateEntityManagerFactory hemf = (HibernateEntityManagerFactory)entityManagerFactory; | ||
| org.hibernate.Cache cache = hemf.getSessionFactory().getCache(); | 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.evictEntityRegions(); | ||
| cache.evictQueryRegions(); | cache.evictQueryRegions(); | ||
| - | cache.evictDefaultQueryRegion(); | ||
| cache.evictCollectionRegions(); | cache.evictCollectionRegions(); | ||
| </ | </ | ||
| + | |||
| + | ===== 참고 ===== | ||
| + | * [[http:// | ||