加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 无法使用ehcache配置JPA

发布时间:2020-12-14 19:13:30 所属栏目:Java 来源:网络整理
导读:我一直在尝试使用ehcache配置JPA但直到现在都没有成功.我正在做的配置是: persistence.xml ehcache.xml

我一直在尝试使用ehcache配置JPA但直到现在都没有成功.我正在做的配置是:

> persistence.xml

> ehcache.xml

> Product.java

@Entity
@Table(name="PRODUCT")
@NamedQueries({@NamedQuery(name="getAllProducts",query = "select products from Product products")})
public class Product implements Serializable {}

我没有得到任何例外,但我看不到ehcache在日志中打印的ehcache没有特定的功能.
如果有人可以提供帮助,我将非常感激.

最佳答案
在persistence.xml中添加以下属性:

在类路径中添加以下jar:ehcache-core-2.4.4.jar,ehcache-openjpa-0.2.0.jar和slf4j-api-1.6.1.jar.

就这样.

Jar下载:

>链接 – http://ehcache.org/downloads/catalog?activated=true
> ehcache-core-2.4.4.jar和slf4j-api-1.6.1.jar – ehcache-core-2.4.4-distribution.tar.gz module
> ehcache-openjpa-0.2.0.jar – ehcache-openjpa-0.2.0-distribution.tar.gz

参考

> L2缓存解释 – http://blogs.oracle.com/carolmcdonald/entry/jpa_caching
> OpenJPA L2缓存实施 – http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_caching.html
> Ehcache OpenJPA实施 – http://www.ehcache.org/documentation/user-guide/openjpa-provider

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读