需要一个示例如何使用Wildfly 8.2启用Hibernate查询缓存

时间:2015-04-11 19:49:11

标签: java hibernate wildfly

我尝试在我的应用程序中启用Hibernate查询缓存,该缓存在Wildfly 8.2中运行。我仔细阅读了所有文件。

任何人都可以给我一个简约的例子,我必须做什么。请包括所有配置,如persistence.xml,hibernate.cfg.xml,...

配置缓存后,执行查询后运行以下代码以检查缓存是否有效。

log.trace("getEntityLoadCount: " + statistic.getEntityLoadCount());
log.trace("getTransactionCount: " + statistic.getTransactionCount());
log.trace("getQueryCacheHitCount: " + statistic.getQueryCacheHitCount());
log.trace("getQueryCacheMissCount: "
            + statistic.getQueryCacheMissCount());
log.trace("getQueryCachePutCount: " + statistic.getQueryCachePutCount());
log.trace("getSecondLevelCacheHitCount: "
            + statistic.getSecondLevelCacheHitCount());
log.trace("getSecondLevelCacheMissCount: "
            + statistic.getSecondLevelCacheMissCount());
log.trace("getSecondLevelCachePutCount: "
            + statistic.getSecondLevelCachePutCount());
log.trace("getSecondLevelCacheRegionNames: "
            + Arrays.toString(statistic.getSecondLevelCacheRegionNames()));

0 个答案:

没有答案