【问题标题】:Clearing Query Cache Using JPA使用 JPA 清除查询缓存
【发布时间】:2013-07-24 18:36:28
【问题描述】:

我想使用 JPA 清除查询缓存,我有 EntityManager 的引用。

请建议我怎样才能做到这一点。

我使用 hibernate 3.0 作为 JPA 与无状态 EJB 的实现。

我发现的一种方法是从 EntityManager 获取 getDelegate,然后获取 SessionFactory,然后对其调用 evict。

还有其他方法吗?

【问题讨论】:

    标签: hibernate jpa query-cache


    【解决方案1】:

    ((JpaCache) getEntityManager().getEntityManagerFactory().getCache()).clearQueryCache(namedQueryName)

    【讨论】:

      猜你喜欢
      • 2017-02-02
      • 2010-12-24
      • 2013-03-11
      • 2023-03-04
      • 2018-07-09
      • 2011-06-01
      • 2014-10-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多