【发布时间】:2013-07-24 18:36:28
【问题描述】:
我想使用 JPA 清除查询缓存,我有 EntityManager 的引用。
请建议我怎样才能做到这一点。
我使用 hibernate 3.0 作为 JPA 与无状态 EJB 的实现。
我发现的一种方法是从 EntityManager 获取 getDelegate,然后获取 SessionFactory,然后对其调用 evict。
还有其他方法吗?
【问题讨论】:
标签: hibernate jpa query-cache
我想使用 JPA 清除查询缓存,我有 EntityManager 的引用。
请建议我怎样才能做到这一点。
我使用 hibernate 3.0 作为 JPA 与无状态 EJB 的实现。
我发现的一种方法是从 EntityManager 获取 getDelegate,然后获取 SessionFactory,然后对其调用 evict。
还有其他方法吗?
【问题讨论】:
标签: hibernate jpa query-cache
((JpaCache) getEntityManager().getEntityManagerFactory().getCache()).clearQueryCache(namedQueryName)
【讨论】: