找出Cache Hibernate正在使用的是什么?

时间:2012-06-04 15:36:20

标签: hibernate ehcache

有没有任何失败的安全方法可以100%确定Hibernate正在使用什么缓存?也就是说它使用其他东西的EhCache? 感谢。

1 个答案:

答案 0 :(得分:4)

String cacheIntegrationName = ( (SessionFactoryImplementor) sessionFactory )
    .getSettings()
    .getRegionFactory()
    .getClass()
    .getName();

当然Hibernate已经记录了“东西”。启用org.hibernate.cfg.SettingsFactory记录器的调试日志记录,并查找“缓存区域工厂:XYZ”