문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
java:jpa:cache [2015/03/17 00:30] kwon37xi |
java:jpa:cache [2015/03/17 01:13] kwon37xi |
||
---|---|---|---|
줄 8: | 줄 8: | ||
전체 리젼을 다 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(); |