【问题标题】:In openJPA, does queryCache require a RemoteCommitProvider?在 openJPA 中,queryCache 是否需要 RemoteCommitProvider?
【发布时间】:2015-10-15 13:48:36
【问题描述】:

在 openJPA 2.4 中,如果我设置:

<property name="openjpa.QueryCache" value="true"/>

但不要设置openjpa.RemoteCommitProvider 属性,我收到以下错误:

org.apache.openjpa.util.UserException:您尝试使用 RemoteCommitListener,但未指定 RemoteCommitProvider。要使用远程提交侦听器,您必须通过 openjpa.RemoteCommitProvider 配置属性配置远程提交提供程序以使用。

此配置曾经在 openJPA 1.X 中工作

有谁知道 QueryCache 是否绝对需要 openjpa.RemoteCommitProvider 或者这看起来像 openJPA 中的错误?

文档提到openjpa.DataCache 需要openjpa.RemoteCommitProvider,但没有提到openjpa.QueryCache 需要这一点

【问题讨论】:

    标签: caching persistence openjpa


    【解决方案1】:

    我认为您遇到的问题是一个奇怪的配置问题。据我所知,您必须启用 QueryCache,但不能启用 DataCache。?如果不是这样,请忽略我的其余帖子。

    我记得当您启用openjpa.DataCache 时,运行时会自动为您配置一个 RemoteCommitProvider。使用 DataCache/QueryCache 时需要 RCP。在您的情况下,如果您只启用了 QueryCache,则不会自动配置 RCP。

    我还在摸不着头脑,为什么要配置没有 DataCache 的 QueryCache?这是一个非常奇怪的用例,因为使用此设置,您不太可能遇到缓存命中,并且您付出的缓存对您没有帮助。

    【讨论】:

    • 正确,QueryCache 但没有 DataCache。我不能肯定地说他应该在缓存方面有帮助,但我可以告诉你的是,这个配置在 JPA 1.X 中有效,在 2.4.X 中失败。文档在解释这些方面不是很有帮助缓存.....
    • 老实说,我不确定 1.0.x 上到底发生了什么?当你有这个配置时。如果您愿意,请继续打开带有文档更新的 JIRA 以使事情更清晰?
    猜你喜欢
    • 1970-01-01
    • 2010-10-30
    • 2012-07-29
    • 2011-11-02
    • 2014-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多